Reputation: 6996
I am using Asp.Net/C#
in my application.I have a menu on my master page
which displays all pre-defined menu items(static way) like
What I would like to accomplish is, I want the text of <a>
element to be displayed from database , which will be the name of the logged-in user.
Can anybody suggest me as to how I can go about doing this. Thanks
Upvotes: 0
Views: 159
Reputation: 2145
if i understand correctly if you want username in the menu and Concatinate that menu with userName then just store @@username in database with menu and when loading replace @@username with the user
using String.replace("@@username",strUserName)
Upvotes: 0
Reputation: 148624
<ul>
<li>
<a>Home</a>
</li>
<li>
<a>Contact Us</a>
</li>
<li>
<a><%=Request.LogonUserIdentity.Name %></a>
</li>
</ul>
however - you need windows authentications in order to see the real logged on user - otherwise youll see the AppPool user.
p.s. if youre under binding context : use <%#
Upvotes: 1