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.
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 = ...;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.