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 ?
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.
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.
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 ?
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.