An error has occurred.I got this error when I was doing some R&D on a dotnetnuke skin control.
DotNetNuke.Services.Exceptions.PageLoadException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). ---> System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). at System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) at DotNetNuke.UI.Skins.Skin.Page_Init(Object sender, EventArgs e) at System.Web.UI.Control.OnInit(EventArgs e) at System.Web.UI.UserControl.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at DotNetNuke.Framework.DefaultPage.Page_Init(Object sender, EventArgs e) at System.Web.UI.Control.OnInit(EventArgs e) at System.Web.UI.Page.OnInit(EventArgs e) at DotNetNuke.Framework.PageBase.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---
Steps to generate: If you are familiar with DotNetNuke, you know that we can use <%= SkinPath %> in
a DNN skin control to dynamically reference folder where skin is stored and append it to the image name.
Under normal cirmustances it will work, but when you use this variable into a control which is set to runat="server", on the next postback you will get this error.
<td id="TopPane" runat="server">The above code block in skin file will give error after one postback.
<img src="<%= SkinPath %>something.jpg"/>
</td>
Resolution:
Do not attempt to use <%= SkinPath %> skin path in to a control set to runat="server"Post your comments if this has helped you.
thnx buddy , your suggestion was fruitful to me... :)
ReplyDeleteThis actually worked for me too despite all of my searching. I am building this in SharePoint, and I was trying to append a variable onto a URL:
ReplyDelete...ClientCoordination.aspx?ClientValidID=<% Response.Write(Request.QueryString[ "ClientValidID" ]); %>...
Was getting an error, but once I moved out of the runat server tags, all working. Thanks!