Wednesday, December 12, 2007

Accessing controls in a MasterPage

If you have a regular .aspx page that utilizes a MasterPage and you need to access certain controls, like a label, within that MasterPage, it's as simple as adding this sort of code to your .aspx code:

Dim someLabel As Label = Master.FindControl("lbl_someLabel")
someLabel.Text = "Clients"