|
-
Jan 28th, 2006, 08:49 PM
#1
Thread Starter
Frenzied Member
Code in Master Page
I'm a real newbie when it comes to web apps.
What I'd like to do is add some code to my .master page. The .master page has a Login control, and I'd like to display something like "Welcome, Guest" or "Welcome, Elvis" when the user is logged in.
I added a label to the master page and tried to do something like
Code:
<asp:Label ID="lblWelcome" runat="server" Text="Welcome, <%=Login1.UserName %>" ></asp:Label>
but even when successfully logged in, it just displays "Welcome,".
I guess master pages don't have a code file associated with them? I'm not sure. Searched around, but I'm so ignorant I'm not sure what I'm looking for.
Any help is appreciated, thanks.
Mike
-
Jan 29th, 2006, 12:10 PM
#2
Hyperactive Member
Re: Code in Master Page
I'm assuming you are using 2.0? If so its pretty easy, go to the Login Section on the toobar and drag in a "LoginStatus Control"
-
Jan 29th, 2006, 12:26 PM
#3
Thread Starter
Frenzied Member
Re: Code in Master Page
Thanks for the reply, yes it's 2.0. I didn't know about the LoginStatus class - pretty nice.
Still, I'd like to tweak it some. I can have the initial text say "Welcome, Guest", but where do I put the code to change that to "Welcome, seidel1" when you log in?
Thanks,
Mike
-
Jan 29th, 2006, 08:32 PM
#4
Hyperactive Member
Re: Code in Master Page
You can edit the controls using edit template. Also you can put a label in before the controls.
Check out the Wrox book Beginning ASP 2.0, there is a good section on this
-
Jan 29th, 2006, 11:51 PM
#5
Thread Starter
Frenzied Member
Re: Code in Master Page
Fair enough, I need to do some reading. I have no idea yet what an edit template is, and although I could drop a label in, I still don't know how to manipulate it via code. That's my problem not yours 
I guess this would be a lot easier on me if a .master file had a code-behind file. If I had somewhere to write some code, I'd be ok I think.
Thanks,
Mike
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|