Access controls in Master Page
Saturday 06 February 2010
To access controls in your master pages is actually quite simple. The below example is for settings an image ImageUrl, but you can access textboxes etc, just replace image with the required field.
If your image in the Master Page is like below:
-
<asp:image id="img1" runat="server" imageurl="/images/imagename.gif" />
Then in your .aspx.vb file use the below code:
-
Dim strImage As Image = Me.Master.FindControl("img1")
-
strImage.ImageUrl = "/images/newimagesfilename.gif"
Where you see img1, that's the id of the control you are trying to access, change it as necessary.
|
(4)
|
|
|