Quote:
quote:Originally posted by Imar
Hi there,
You can't do that directly with the LoginName control. You can set the FormatString property to customize the welcome text a but, bit it will always display the user name.
You can, however, use a LoginView control with a LoggedInTemplate that only shows for logged in users like this:
Code:
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
Hi there:
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</LoggedInTemplate>
</asp:LoginView>
Then from the code behind you can set the text of the label. You need to use FindControl on the LoginView to find the label first.
First name and last names are not available out of the box. Look into [ur="http://quickstarts.asp.net/QuickStartv20/aspnet/doc/profile/default.aspx"l]ASP.NET Profiles[/url] for some ideas about storing user specific data.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
|
Hi Imar,
I am unable to get reference to the label control inside the LoggedInTemplate.
I m trying to set the text of label to first name + last name in the LoggedIn Event of Login control. Howerver when I do a FindControl on LoginView it always returns a null.
I read in some documnetation that the LoggedInTemplate controls are not generated at this stage?
So how do I access the controls insided loggedInTemplate?
Thnaks,
--Monika