C
clintonG
I'm having a problem with a label in a MasterPage which is not in a
ContentPlaceHolder. The naughty label will not allow me to change its text
property.
<%-- renders the label's text directly to the page --%>
<div id="footer">
<asp:Label ID="CurrentTimeLabel" runat="server" Text="CurrentTimeLabel">
</div>
When the control is not in a ContentPlaceHolder I should be able to access
the control directly...
// direct access
CurrentTimeLabel.Text = DateTime.Now.ToString();
When the page is rendered, the label control emits a span in the HTML
source but no text property! So I tried getting a reference to the control.
// should get a reference to a label control that is not in a
ContentPlaceHolder
Label currentTime = (Label)Master.FindControl("CurrentTimeLabel");
currentTime.Text = "Found CurrentTimeLabel";
Still no text being rendered! This is very strange for me. I don't
understand why all of a sudden I can't access the property of a label
in the MasterPage.
<%= Clinton Gallagher
ContentPlaceHolder. The naughty label will not allow me to change its text
property.
<%-- renders the label's text directly to the page --%>
<div id="footer">
<asp:Label ID="CurrentTimeLabel" runat="server" Text="CurrentTimeLabel">
</div>
When the control is not in a ContentPlaceHolder I should be able to access
the control directly...
// direct access
CurrentTimeLabel.Text = DateTime.Now.ToString();
When the page is rendered, the label control emits a span in the HTML
source but no text property! So I tried getting a reference to the control.
// should get a reference to a label control that is not in a
ContentPlaceHolder
Label currentTime = (Label)Master.FindControl("CurrentTimeLabel");
currentTime.Text = "Found CurrentTimeLabel";
Still no text being rendered! This is very strange for me. I don't
understand why all of a sudden I can't access the property of a label
in the MasterPage.
<%= Clinton Gallagher