Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 29th, 2007, 06:57 PM
Authorized User
 
Join Date: Jun 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot.
Things are working for me now.
 
Old July 10th, 2007, 06:09 PM
Authorized User
 
Join Date: Jun 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old July 11th, 2007, 12:42 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yeah, I think it's indeed too late. The security is applied early in the life cycle, so the LoggedInTemplate is probably not available right after you log in on that page.

You could reload the page and then access it from Page_Load. Why do you need to access it right away?

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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
asp.net login control kulkarnimonica ASP.NET 2.0 Professional 6 September 25th, 2007 05:22 PM
ASP.net login page in C# in 2.0 debjanib ASP.NET 2.0 Basics 4 March 23rd, 2007 08:46 AM
login control problem (asp.net2.0 website progr..) rookie07 ASP.NET 2.0 Basics 1 June 22nd, 2006 09:25 AM
ASP.NET Login Control Question adnanjamil ASP.NET 2.0 Professional 1 April 30th, 2006 07:48 PM
Login Form ASP.NET mrideout BOOK: Beginning ASP.NET 1.0 4 July 19th, 2004 11:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.