G
Guest
For some reason when I use asp controls for the default content of a
ContentPlaceHolder, they do not get rendered. Static content is rendered just
fine however! Specifically I'm using multiple <asp:Image> and <asp:HyperLink>
controls and when I copy & paste them into a regular page, they work fine.
When I paste them into the Master page's ContentPlaceHolder, they do not
render. When I view the resulting page source, the controls are completely
missing, almost as if I had set the Visible property to false on all of them
(which of course, I am not doing).
Also worth noting, if I include any inline asp with my default content while
also using asp controls, I get the following runtime error:
Specified argument was out of the range of valid values. Parameter name: index
If I remove the controls from the ContentPlaceHolder, the inline code runs
fine!?
Here's the ContentPlaceHolder ASP.net code:
<asp:ContentPlaceHolder ID="cphHeader" runat="server" >
<%if (true) { string s = "some example code"; } %>
<asp:HyperLink runat="server" ID="HyperLink1"
NavigateUrl="~/default.aspx">
<asp:Image runat="server" ID="Image1"
ImageUrl="~/images/Logo.gif" ImageAlign="AbsMiddle" />
</asp:HyperLink>
<asp:Image runat="server" ID="Image2"
ImageUrl="~/images/lock.gif" ImageAlign="AbsMiddle" />
</asp:ContentPlaceHolder>
If I remove the inline asp code (line 2), I don’t get a runtime error
anymore, but none of the controls are rendered. If I move the controls
outside of the ContentPlaceHolder, they render fine!?
I am completely lost as to what is going on here. PLEASE help if you have
any ideas!!
Thanks.
-Nick
ContentPlaceHolder, they do not get rendered. Static content is rendered just
fine however! Specifically I'm using multiple <asp:Image> and <asp:HyperLink>
controls and when I copy & paste them into a regular page, they work fine.
When I paste them into the Master page's ContentPlaceHolder, they do not
render. When I view the resulting page source, the controls are completely
missing, almost as if I had set the Visible property to false on all of them
(which of course, I am not doing).
Also worth noting, if I include any inline asp with my default content while
also using asp controls, I get the following runtime error:
Specified argument was out of the range of valid values. Parameter name: index
If I remove the controls from the ContentPlaceHolder, the inline code runs
fine!?
Here's the ContentPlaceHolder ASP.net code:
<asp:ContentPlaceHolder ID="cphHeader" runat="server" >
<%if (true) { string s = "some example code"; } %>
<asp:HyperLink runat="server" ID="HyperLink1"
NavigateUrl="~/default.aspx">
<asp:Image runat="server" ID="Image1"
ImageUrl="~/images/Logo.gif" ImageAlign="AbsMiddle" />
</asp:HyperLink>
<asp:Image runat="server" ID="Image2"
ImageUrl="~/images/lock.gif" ImageAlign="AbsMiddle" />
</asp:ContentPlaceHolder>
If I remove the inline asp code (line 2), I don’t get a runtime error
anymore, but none of the controls are rendered. If I move the controls
outside of the ContentPlaceHolder, they render fine!?
I am completely lost as to what is going on here. PLEASE help if you have
any ideas!!
Thanks.
-Nick