Reputation: 1571
I would like to carry out some string operations on the username in my Site.Master page before rendering it on the page.
Here's what the current code looks like:
<div class="login">
<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
<LoggedInTemplate>
Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>
</LoggedInTemplate>
</asp:LoginView>
</div>
For some reason, I cannot reference HeadLoginName.Text or something similar. What am I missing here?
Thanks for looking.
Upvotes: 2
Views: 1360
Reputation: 9300
Possible Duplicate:
It is necessary to find the "HeadLoginName" control inside the "HeadLoginView" container first and then specify its Text property (see the Find Control with in LoginView control blog post for more information):
LoginName ln = (LoginName)HeadLoginView.FindControl("HeadLoginName");
ln.Text = ...;
Upvotes: 1