English 中文(简体)
显示横向菜单中现有用户名称
原标题:Display the name of current user in the horizontal menu

I am using Asp.Net/C#.I am using Asp.Net s built-in Membership Framework.I have a requirement wherein the current(logged-in) user s name should be displayed in the horizontal menu towards the right side.The aspnet_Users table stores the UserName in the form of some code like ppp001 where as the actual name of the user For Example: John Smith is stored in the table which is linked to aspnet_Users table using a Foreign Key constraint.So my question is how do I display the users name from that table to my menu.Should I use repeater control. Any suggestions are welcome.

成就

最佳回答

这样做的最简单办法是将首个名字和最后名称存放在简介提供者,然后使用一个贴上“永久”的标签或iv。

页: 1

<profile enabled="true">
    <properties>
        <add name="FirstName" type="string"/>
        <add name="LastName" type="string"/>
    </properties>
</profile>

之后再贴上 your子或标签

   FirstName.Text = Profile.FirstName;
   LastName.Text = Profile.LastName;

使用简介提供者的不利之处在于,所有简介性特性都被混为一谈,因此很难对此提出质疑。 这样做的最好办法是,利用你提到的外国钥匙,创建自己的基地类别,呼吁数据库检索第一个名称和最后名称。 我通常把这套财产交给我的LobedInUser。 这样,你们的所有网页都可以通过这一途径获得。 页: 1

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签