Access MasterPage component

  • Thread starter Thread starter =?ISO-8859-1?Q?Mika=EBl_PLOUHINEC?=
  • Start date Start date
?

=?ISO-8859-1?Q?Mika=EBl_PLOUHINEC?=

Hello,

I have a master page with a label. In the "children page" in the
Page_Load function for example, I would like to change the text of the
label in the master page.

Is that possible? How can I do taht?

Thanks a lot.

Mike
 
Mikaël PLOUHINEC said:
Hello,

I have a master page with a label. In the "children page" in the
Page_Load function for example, I would like to change the text of the
label in the master page.

Is that possible? How can I do taht?

Thanks a lot.

Mike

Mike,

In VB

Dim objLabel as Label = CType(Master.FindControl("lblMyLabel"), label)
objLabel.Text = "Whatever you want"

Regards,
Steve
 
In VB

Dim objLabel as Label = CType(Master.FindControl("lblMyLabel"), label)
objLabel.Text = "Whatever you want"

And in C#:

((Label)Master.FindControl("lblMyLabel")).Text = "Whatever you want";
 
And I think you need to add the
<%@ MasterType VirtualPath="~/MasterPage.master"%>
directive to the aspx page, right?

-Bill
 
Back
Top