Tuesday, May 22, 2007

Accessing Controls on Master Pages from Content Pages

Accessing Controls on Master Pages from Content Pages
Let's say you have a label called 'Label4' on your Master Page. You might want to change the text of that label, to something different, from each content page you have in your site. To do that, it's very easy:
Dim lbl As Label
lbl = CType(Master.FindControl("Label4"), Label)
lbl.Text = "whatever"
(of course, this is all assuming the label is OUTSIDE the ContentPlaceHolder)

No comments: