Master Page Question

J

Jeff

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

Guest

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

Jeff

Spam Catcher said:
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("ContentPlaceHolder1").FindControl("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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top