After uploading and aplying a skin that is refering some images, I'm geting this error for everypage:
Error:The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)
Looking into the generated ascx file, I see that the "cause" is that before the images name, DNN added <%= SkinPath %>.
Any tips on how to solve this problem? I'm a DNN user, and my development skills are very poor, but I would like to avoid doing hard references to the image like /portals/0/images/image.gif, so that I can apply this skin to different servers/portals.
But looking into my html, the runat=server is always applied in a <TD> tag, and the images are outside its scope. Should it work ok this way or it doesn't matter where the attribute is in the skin?
This also happens if you are trying to link to a style sheet using the link tag. Remove this and I think if you call your stylesheet skin.css you can access classes from that without having to link the stylesheet. I am no expert tho but we've just been having
this exact same problem.
But looking into my html, the runat=server is always applied in a <TD> tag, and the images are outside its scope. Should it work ok this way or it doesn't matter where the attribute is in the skin?
PS - still usgin DNN3.1.1
No, that won't work.
When you mark an element like <TD>, <P>, <SPAN>, <DIV>, as runat=server then that makes it a Skin Pane.
If there is an image element inside a Skin Pane then DNN will add the <%= SkinPath %> variable when the skin is uploaded/installed.
This will not work:
<td id="ContentPane" runat="server"><img src="image.gif"></td>
If you do something like this it will work though :
<td > <img src="image.gif"><span id="ContentPane" runat="server"></span></td>
pamscosta
Member
10 Points
2 Posts
Error:The Controls collection cannot be modified because the control contains code blocks (i.e. <...
Nov 17, 2005 10:03 PM|LINK
Hi,
After uploading and aplying a skin that is refering some images, I'm geting this error for everypage:
Error:The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)
Looking into the generated ascx file, I see that the "cause" is that before the images name, DNN added <%= SkinPath %>.
Any tips on how to solve this problem? I'm a DNN user, and my development skills are very poor, but I would like to avoid doing hard references to the image like /portals/0/images/image.gif, so that I can apply this skin to different servers/portals.
Thanks in advance,
PC
J7Mitch
Star
13145 Points
2632 Posts
Re: Error:The Controls collection cannot be modified because the control contains code blocks (i....
Nov 17, 2005 10:26 PM|LINK
You can avoid this by not putting images in any element that has a runat=server attribute.
It usually happens when there is an image in a Skin Pane.
pamscosta
Member
10 Points
2 Posts
Re: Error:The Controls collection cannot be modified because the control contains code blocks (i....
Nov 17, 2005 10:38 PM|LINK
Thanks.
But looking into my html, the runat=server is always applied in a <TD> tag, and the images are outside its scope. Should it work ok this way or it doesn't matter where the attribute is in the skin?
PS - still usgin DNN3.1.1
blueraccoon
Member
158 Points
26 Posts
Re: Error:The Controls collection cannot be modified because the control contains code blocks (i....
Nov 19, 2005 03:08 PM|LINK
J7Mitch
Star
13145 Points
2632 Posts
Re: Error:The Controls collection cannot be modified because the control contains code blocks (i....
Nov 19, 2005 03:37 PM|LINK
No, that won't work.
When you mark an element like <TD>, <P>, <SPAN>, <DIV>, as runat=server then that makes it a Skin Pane.
If there is an image element inside a Skin Pane then DNN will add the <%= SkinPath %> variable when the skin is uploaded/installed.
This will not work:
<td id="ContentPane" runat="server"><img src="image.gif"></td>
If you do something like this it will work though :
<td > <img src="image.gif"><span id="ContentPane" runat="server"></span></td>
lostxp
Member
79 Points
15 Posts
Re: Error:The Controls collection cannot be modified because the control contains code blocks (i....
Dec 07, 2005 06:16 AM|LINK
Instead use this <%# blah blah %>