Results 1 to 5 of 5

Thread: using master label , like the idea of masterpage!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    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 ?

  2. #2
    Fanatic Member space_monkey's Avatar
    Join Date
    Apr 2005
    Location
    神と歩くこと
    Posts
    573

    Re: using master label , like the idea of masterpage!

    Here's one way to do it.

    VB Code:
    1. Dim MasterLabel as Label = Ctype(Page.Master.FindControl("[Your Control Name]"),Label)
    2. 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

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    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 ?

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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
  •  



Click Here to Expand Forum to Full Width