|
-
Dec 7th, 2007, 06:32 AM
#1
Thread Starter
Addicted Member
using master label , like the idea of masterpage!
I'm using masterpage , can I place a label on my masterpage and call it from other pages , say I want to display a message to the user displaying for example ( your request has been sent successfully) appearing on the top of the page. I don't want to place a label in every content page , I only want to use one label for all pages , is this possible ?
-
Dec 7th, 2007, 09:06 AM
#2
Fanatic Member
Re: using master label , like the idea of masterpage!
Here's one way to do it.
VB Code:
Dim MasterLabel as Label = Ctype(Page.Master.FindControl("[Your Control Name]"),Label)
If Not MasterLabel is Nothing then MasterLabel.Text = "Your Text"
That should give you access to the label on the master page. There might be a simpler way to do it but i'm not sure.
Using VB6 or VB.net 2008 with .net 3.5
"Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad
-
Dec 8th, 2007, 02:56 AM
#3
Re: using master label , like the idea of masterpage!
That is the entire purpose of Master Pages. Everything else you put on a MasterPage is in fact a control too.
-
Dec 8th, 2007, 06:44 AM
#4
Thread Starter
Addicted Member
Re: using master label , like the idea of masterpage!
Great , that's exactly what I needed
One more thing , how do I move the code to a class ?
-
Dec 10th, 2007, 12:22 PM
#5
Re: using master label , like the idea of masterpage!
That's a very vague and generic question. Technically, your code is always in a class. You need to specify what code you're trying to move and to what sort of a class, and why.
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
|