c# - how to set user login name as menu item in asp.net LoginView -


i trying create menu item within web app sets parent node username of current user logged website. child nodes same incontext.

currently have been trying write out user name using <% page.user.identity.name.tostring(); %> have found once user logs site value stays null. below entire code block have been playing with. you'll notice loginname control still in place (for testing)

<asp:loginview id="headloginview" runat="server" enableviewstate="false">     <anonymoustemplate></anonymoustemplate>     <loggedintemplate>                     <div class="logindisplay">          welcome&nbsp;          <% page.user.identity.name.tostring(); %>          <asp:loginname id="headloginname" runat="server" /> &nbsp; |           <asp:loginstatus id="headloginstatus" runat="server"                logoutaction="redirect" logouttext="log out" logoutpageurl="~/" />         </div>                  </loggedintemplate> </asp:loginview> 

my hope have menu item looks like

username ( parent node) + menu item 1 (child node) + menu item 2 (child node)

using above approach may not correct appreciate suggestions, or comments more efficient approaches well.

thanks in advance

you forgot equal sign. won't need .tostring() bit either since equal sign means.

<%= page.user.identity.name %>   

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -