Master Page Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff

    #1

    Master Page Question


    ....if this isn't the best newsgroup for this question, perhaps someone can
    point me to the best one.

    If I'm using vb.net with visual studio 2005 ..

    and I want to create a button on a master page and have that button run code
    contained on another page, how might I best accomplish this?

    Thanks

    Jeff


  • Spam Catcher

    #2
    Re: Master Page Question

    "Jeff" <none@nothingX. comwrote in
    news:eVDTyTUoHH A.596@TK2MSFTNG P06.phx.gbl:
    and I want to create a button on a master page and have that button
    run code contained on another page, how might I best accomplish this?
    What do you mean run code on another page? Like execute a function that is
    in a codebehind file of another ASPX page?

    You can just instantiate Page B in Page A and call the function if it's
    public. Or even better, move the function to a class file... and
    instantiate the class.

    Comment

    • Jeff

      #3
      Re: Master Page Question


      "Spam Catcher" <spamhoneypot@r ogers.comwrote in message
      news:Xns993E85F 7CB320usenethon eypotrogers@127 .0.0.1...
      "Jeff" <none@nothingX. comwrote in
      news:eVDTyTUoHH A.596@TK2MSFTNG P06.phx.gbl:
      >
      >and I want to create a button on a master page and have that button
      >run code contained on another page, how might I best accomplish this?
      >
      What do you mean run code on another page? Like execute a function that is
      in a codebehind file of another ASPX page?
      >
      You can just instantiate Page B in Page A and call the function if it's
      public. Or even better, move the function to a class file... and
      instantiate the class.

      I think that I'm figuring out most of this from your hint. Here is what I
      still don't get.

      I have a button on a master page and would like to control a label on a
      content page that relies upon the master.

      if I use the code below in the next button it will work to change label1 on
      the content page.
      Dim lbl As Label =
      Me.FindControl( "ContentPlaceHo lder1").FindCon trol("label1")
      lbl.Text = "testing"

      But if I want to take the code above and move it to a sub in a class file, I
      can't figure out how to modify the
      Me.FindControl (in the code above)
      so that I can refer to the masterpage that called the sub.

      Can you point me in the right direction?

      Thanks

      Jeff

      Comment

      Working...