error "object reference not set to an instance of an object" when open custom webpart in sharepoint DesignerHi All<br/><br/>I have created custom webparts and use these webparts into Moss site and it is working fine, but when we try to open the page(which contains custom webparts), into Sharepoint Designer then error &quot;object reference not set to an instance of an object&quot; is displayed at the Webparts and Webparts are not able to visible in Sharepoint Designer.<br/><br/>Please Suggest the solution.<br/><br/>Thanks<br/>Ashish© 2009 Microsoft Corporation. All rights reserved.Wed, 08 Jul 2009 13:47:13 Zc4588d11-b21a-4924-8296-34a92c06a7dbhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c4588d11-b21a-4924-8296-34a92c06a7db#c4588d11-b21a-4924-8296-34a92c06a7dbhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c4588d11-b21a-4924-8296-34a92c06a7db#c4588d11-b21a-4924-8296-34a92c06a7dbAshishKumarVermahttp://social.msdn.microsoft.com/Profile/en-US/?user=AshishKumarVermaerror "object reference not set to an instance of an object" when open custom webpart in sharepoint DesignerHi All<br/><br/>I have created custom webparts and use these webparts into Moss site and it is working fine, but when we try to open the page(which contains custom webparts), into Sharepoint Designer then error &quot;object reference not set to an instance of an object&quot; is displayed at the Webparts and Webparts are not able to visible in Sharepoint Designer.<br/><br/>Please Suggest the solution.<br/><br/>Thanks<br/>AshishThu, 02 Jul 2009 14:35:21 Z2009-07-02T14:35:21Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c4588d11-b21a-4924-8296-34a92c06a7db#e7bb13cd-c462-4294-b377-90b57e392b04http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c4588d11-b21a-4924-8296-34a92c06a7db#e7bb13cd-c462-4294-b377-90b57e392b04Mike Walsh MVPhttp://social.msdn.microsoft.com/Profile/en-US/?user=Mike%20Walsh%20MVPerror "object reference not set to an instance of an object" when open custom webpart in sharepoint Designerspd questions go to Design/customization<br/><br/>Moving this<br/><br/><hr class="sig">WSS FAQ sites: <a href="http://wssv2faq.mindsharp.com">http://wssv2faq.mindsharp.com</a> and <a href="http://wssv3faq.mindsharp.com">http://wssv3faq.mindsharp.com</a> <br/>Total list of WSS 3.0 / MOSS 2007 Books (including foreign language) <a href="http://wssv3faq.mindsharp.com/Lists/v3 WSS FAQ/V Books.aspx">http://wssv3faq.mindsharp.com/Lists/v3%20WSS%20FAQ/V%20Books.aspx</a>Thu, 02 Jul 2009 14:55:19 Z2009-07-02T14:55:19Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c4588d11-b21a-4924-8296-34a92c06a7db#232cb91c-aea0-43df-a8f9-dd26a0559f89http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c4588d11-b21a-4924-8296-34a92c06a7db#232cb91c-aea0-43df-a8f9-dd26a0559f89ccvalenchttp://social.msdn.microsoft.com/Profile/en-US/?user=ccvalencerror "object reference not set to an instance of an object" when open custom webpart in sharepoint DesignerI´m not sure, but if you use the context maybe on designer context be null and because of it, give you this error.<br/><br/>What kind of webpart or operations do? Can you put some code?<hr class="sig">Microsoft MCP 6608628 Thu, 02 Jul 2009 15:11:18 Z2009-07-02T15:11:18Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c4588d11-b21a-4924-8296-34a92c06a7db#980ec360-4080-4477-bfb1-98634400e65chttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c4588d11-b21a-4924-8296-34a92c06a7db#980ec360-4080-4477-bfb1-98634400e65cAshishKumarVermahttp://social.msdn.microsoft.com/Profile/en-US/?user=AshishKumarVermaerror "object reference not set to an instance of an object" when open custom webpart in sharepoint DesignerWe have created custom webpart which is inherited from Microsoft System.web.ui.webcontrols.webparts.Webpart class.<br/>like this<br/><br/>public class CustomWebPart01 : WebPart<br/>{<br/>implementation code<br/>}<br/><br/> I have also remove the use of SPcontext to pick site url and start picking site URL from web.config fileas using appsettings, but still the same error has woccurs.<br/><br/>Fri, 03 Jul 2009 11:28:32 Z2009-07-03T11:28:32Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c4588d11-b21a-4924-8296-34a92c06a7db#5c81256c-a5cc-4e40-b0f2-c7f044a01e7ahttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c4588d11-b21a-4924-8296-34a92c06a7db#5c81256c-a5cc-4e40-b0f2-c7f044a01e7aDave Hunterhttp://social.msdn.microsoft.com/Profile/en-US/?user=Dave%20Huntererror "object reference not set to an instance of an object" when open custom webpart in sharepoint DesignerCan you edit an out of the box webpart with SPD?  Just trying to find out if its a code issue with your custom webpart or a SPD issue?  If you can edit a standard webpart, can you post your code for your custom webparts?<br/><br/>Dave<hr class="sig">My SharePoint Blog - <a href="http://www.davehunter.co.uk/blog">http://www.davehunter.co.uk/blog</a>Fri, 03 Jul 2009 14:16:07 Z2009-07-03T14:16:07Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c4588d11-b21a-4924-8296-34a92c06a7db#a0546d5f-4aa4-4374-9ba5-26a893bd7959http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c4588d11-b21a-4924-8296-34a92c06a7db#a0546d5f-4aa4-4374-9ba5-26a893bd7959AshishKumarVermahttp://social.msdn.microsoft.com/Profile/en-US/?user=AshishKumarVermaerror "object reference not set to an instance of an object" when open custom webpart in sharepoint Designer<p>Hi<br/><br/>I have tried a lot and come to know that when I put my custom web part dll into bin directory of the the web site and then add custom web part to the web page of the site and open the page (containing custom web part) in sharepoint designer is displaying fine.<br/>but when i put same dll into GAC(C:\windows\assembly) and add custom web part to the web page of the site and open it in the sharepoint designer then error &quot;object reference not set to an instance of an object&quot; occurs.<br/>Means the same dll is working fine from bin directory of the site.<br/><br/>But the requirement is to put the dll in the GAC(C:\windows\assembly), so please suggest the solution.<br/>code for the custom web part dll is as follows<br/><br/>using System;<br/>using System.Collections.Generic;<br/>using System.Linq;<br/>using System.Text;<br/>using System.Web.UI.HtmlControls;<br/>using System.Web.UI.WebControls.WebParts;<br/>using Microsoft.SharePoint;<br/>using System.Web;<br/>using System.Net;<br/>namespace Test<br/>{<br/>    public class CustomWebPart01 : WebPart<br/>    {<br/>        private TeamwareServiceInfo twSvcInfo;<br/>        private string _strTwSrvUrl = &quot;&quot;;<br/>        //Default Constructor<br/>        public CustomWebPart01()<br/>        {<br/>            Settings twSettings = (Settings)HttpContext.Current.Application[Def.TeamwareSettings];<br/>            twSvcInfo = twSettings.DefaultTwSvcInfo;<br/>            _strTwSrvUrl = twSvcInfo.ToString();</p> <p>        }<br/>        private string _strDefaultUrl = &quot;&quot;;<br/>        private string _strWidth = &quot;100&quot;;<br/>        private string _strHeight = &quot;100&quot;;</p> <p>        //Custom property to display URL in property sheet.<br/>        [WebBrowsable(true),<br/>        WebDescription(&quot;Displays a custom message&quot;),<br/>        WebDisplayName(&quot;To specify a link, type a URL or path.&quot;),<br/>        Personalizable(PersonalizationScope.User)]</p> <p>        public string DisplayMessage<br/>        {<br/>            get<br/>            {<br/>                return _strDefaultUrl;<br/>            }<br/>            set<br/>            {<br/>                _strDefaultUrl = value;<br/>            }<br/>        }</p> <p>        //Custom property for width in the property sheet.<br/>        [WebBrowsable(true),<br/>        WebDescription(&quot;Display IFrame width in %&quot;),<br/>        WebDisplayName(&quot;Enter IFrame Width[%] &quot;),<br/>        Personalizable(PersonalizationScope.User)]</p> <p>        public string FrameWidth<br/>        {<br/>            get<br/>            {<br/>                return _strWidth;<br/>            }<br/>            set<br/>            {<br/>                _strWidth = value;<br/>            }<br/>        }</p> <p>        //Custom property to display height in the property sheet.<br/>        [WebBrowsable(true),<br/>        WebDescription(&quot;Display IFrame Height in %&quot;),<br/>        WebDisplayName(&quot;Enter IFrame Height[%] &quot;),<br/>        Personalizable(PersonalizationScope.User)]</p> <p>        public string FrameHeight<br/>        {<br/>            get<br/>            {<br/>                return _strHeight;<br/>            }<br/>            set<br/>            {<br/>                _strHeight = value;<br/>            }<br/>        }</p> <p>        //overriding the systems default CreateChildControls method<br/>        protected override void CreateChildControls()<br/>        {<br/>            string _strRequestUrl = &quot;&quot;;</p> <p>            //Code for picking default setting<br/>            if ((_strDefaultUrl == &quot;&quot;) &amp;&amp; (_strTwSrvUrl != &quot;&quot;))<br/>            {<br/>                _strDefaultUrl = _strTwSrvUrl;<br/>            }<br/>            else if (_strTwSrvUrl != &quot;&quot;)<br/>            {<br/>                int nPos = _strDefaultUrl.IndexOf(&quot;//&quot;);<br/>                string _strTemp = &quot;&quot;;<br/>                int nPos1 = -1;<br/>                if (nPos != -1)<br/>                {<br/>                    nPos1 = _strDefaultUrl.IndexOf('/', nPos + 2);<br/>                    if (nPos1 != -1)<br/>                    {<br/>                        _strTemp = _strDefaultUrl.Substring(nPos1 + 1);<br/>                    }<br/>                }<br/>                _strDefaultUrl = _strTwSrvUrl + _strTemp;<br/>            }<br/>            if (_strDefaultUrl != &quot;&quot;)<br/>            {<br/>                int nPos = _strDefaultUrl.IndexOf(&quot;//&quot;);<br/>                int nPos1 = -1;<br/>                if (nPos != -1)<br/>                {<br/>                    nPos1 = _strDefaultUrl.IndexOf('/', nPos + 2);<br/>                    if (nPos1 != -1)<br/>                    {<br/>                        _strRequestUrl = _strDefaultUrl.Substring(0, nPos1);<br/>                    }<br/>                    else<br/>                    {<br/>                        _strRequestUrl = _strDefaultUrl;<br/>                    }<br/>                }<br/>            }<br/>            base.CreateChildControls();<br/>            HtmlGenericControl twoFrame = new HtmlGenericControl(&quot;iframe&quot;);<br/>            twoFrame.ID = &quot;IEFrame&quot;;</p> <p>            //Code to check that temaware server is running or not<br/>            //Commented code is for proxy settings.<br/>            try<br/>            {<br/>                HttpWebResponse _httpWbResponse = null;<br/>                HttpWebRequest _httpWbRequest = null;<br/>                if (_strRequestUrl != &quot;&quot;)<br/>                {<br/>                    _httpWbRequest = (HttpWebRequest)WebRequest.Create(_strRequestUrl);<br/>                    _httpWbRequest.ServicePoint.ConnectionLimit = 50;<br/>                    _httpWbRequest.Timeout = 200000;<br/>                    _httpWbResponse = (HttpWebResponse)_httpWbRequest.GetResponse();<br/>                    if ((_httpWbResponse.StatusCode == HttpStatusCode.OK))<br/>                    {<br/>                        twoFrame.Attributes.Add(&quot;src&quot;, _strDefaultUrl);<br/>                    }<br/>                }</p> <p>            }<br/>            catch (Exception)<br/>            {<br/>                twoFrame.Attributes.Add(&quot;src&quot;, &quot;/_LAYOUTS/ErrorMessages.aspx&quot;);<br/>            }<br/>            //End<br/>            twoFrame.Attributes.Add(&quot;width&quot;, _strWidth + &quot;%&quot;);<br/>            twoFrame.Attributes.Add(&quot;height&quot;, _strHeight + &quot;%&quot;);<br/>            twoFrame.Attributes.Add(&quot;frameborder&quot;, &quot;0&quot;);<br/>            twoFrame.Attributes.Add(&quot;border&quot;, &quot;0&quot;);<br/>            this.Controls.Add(twoFrame);<br/>        }<br/>        <br/>    }<br/>}<br/><br/><br/>Thanks<br/>Ashish</p>Wed, 08 Jul 2009 13:47:13 Z2009-07-08T13:47:13Z