Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking 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 Basics 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 February 4th, 2010, 11:18 PM
Registered User
 
Join Date: Feb 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to update the MasterPage "header"

Hi,

I am a newbie and attempting to learn asp.net.

I have a login textbox, a password textbox, a login button and a LoginStatus label at the top of the master page (in what I would call the "header" section/area). When the login button is clicked, I do the click event of the button, validate the user, and then redirect to the "registration.aspx" page if login was successful. I would like to update the LoginStatus label with a string such as "Welcome {user's username}". As folks navigate through out the various pages of the website, I would like to keep the lblLoginStatus displayed. I want the label to be displayed when the "registration.aspx" is finished loading to give a visual indicator that the login was successful.

I don't know the appropriate approach to accomplish this. I hope this message makes sense.

Thanks
Keith
 
Old February 5th, 2010, 03:12 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Code:
<asp:LoginView ID="loginView" runat="server">
    <AnonymousTemplate>
        <a href="/login.aspx" title="Log in using your user name and password">Log In</a>
    </AnonymousTemplate>
    <LoggedInTemplate>
        Welcome <asp:LoginName ID="loginName" runat="server" />!        
        <asp:LoginStatus ID="loginStatus2" runat="server" LogoutText="Log Out" />      
    </LoggedInTemplate>
</asp:LoginView>
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}





Similar Threads
Thread Thread Starter Forum Replies Last Post
Difficulties with "web.config" and "ASPNETDB" CFRham BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 2 July 3rd, 2010 10:19 AM
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
Code not going as planned: "icicle" vs "savedinstancestate" joopthecat BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 3 May 3rd, 2009 03:09 PM
MasterPage Attribute alink "Outdated?" Psyclist BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 March 28th, 2009 05:04 AM





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