Quantcast
Channel: MSDN Blogs
Viewing all articles
Browse latest Browse all 29128

ASP.NET issue with auto-generated designer page

$
0
0

I have been facing this issue with VS2013, whenever I change my .aspx file (.NET framework 4.5) with updatePanel/Scriptmanager, designer file generate for that control is:

/// <summary>

        /// ScriptManager1 control.

        /// </summary>

        /// <remarks>

        /// Auto-generated field.

        /// To modify move field declaration from designer file to code-behind file.

        /// </remarks>

        protected global::System.Web.UI.WebControls.ScriptManager ScriptManager1;

       

        /// <summary>

        /// UpdatePanel1 control.

        /// </summary>

        /// <remarks>

        /// Auto-generated field.

        /// To modify move field declaration from designer file to code-behind file.

        /// </remarks>

        protected global::System.Web.UI.WebControls.UpdatePanel UpdatePanel1;

But I have to change it to :

/// <summary>

        /// ScriptManager1 control.

        /// </summary>

        /// <remarks>

        /// Auto-generated field.

        /// To modify move field declaration from designer file to code-behind file.

        /// </remarks>

        protected global::System.Web.UI.ScriptManager ScriptManager1;

        

        /// <summary>

        /// UpdatePanel1 control.

        /// </summary>

        /// <remarks>

        /// Auto-generated field.

        /// To modify move field declaration from designer file to code-behind file.

        /// </remarks>

        protected global::System.Web.UI.UpdatePanel UpdatePanel1;

 

Fix:

1) Either reset the System.Web.UI.WebControls.WebParts.UpdatePanel back to System.Web.UI.UpdatePanel (same for ScriptManager) every time the ascx file is modified...[recommended] but tedious

2) I found that using a Register command at the top of the ASCX file seemed to properly override the default behavior of the designer to pick the 4.0 location for the 3.5 control (I think that is the underlying issue, it is a 4.0 designer backwards compatible with 3.5). [Recommended] but be careful while adding controls with <asp: 

 

<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web"%>

...

 <asp:ScriptManager runat="server" ID="smLocationsMap" />

3) You can include system.web.dll, and system.web.design. dll in your bin folder (Security/ Other issues) [Not recommended]

 

I hope this is helpful :)

 


Viewing all articles
Browse latest Browse all 29128

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>