master page label value to author page in vb.net

Posted by Sekar.C under VB.NET on 3/16/2012 | Points: 10 | Views : 1725 | Status : [Member] | Replies : 3
hi,
How can access the master page label value to author page in vb.net
regards
sekar.c

Regards
Sekar.c



Responses

Posted by: Hmanjarawala on: 3/16/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi Sekar,

here is code:

Sub Page_Load()
Dim mpContentPlaceHolder As ContentPlaceHolder
Dim mpTextBox As TextBox
mpContentPlaceHolder = _
CType(Master.FindControl("ContentPlaceHolder1"), _
ContentPlaceHolder)
If Not mpContentPlaceHolder Is Nothing Then
mpTextBox = CType(mpContentPlaceHolder. _
FindControl("TextBox1"), TextBox)
If Not mpTextBox Is Nothing Then
mpTextBox.Text = "TextBox found!"
End If
End If

' Gets a reference to a Label control not in a
' ContentPlaceHolder
Dim mpLabel As Label
mpLabel = CType(Master.FindControl("masterPageLabel"), Label)
If Not mpLabel Is Nothing Then
Label1.Text = "Master page label = " + mpLabel.Text
End If
End Sub


Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 3/16/2012 [Member] Silver | Points: 25

Up
0
Down
Hi Sekar
In the Author page :
//c#
Label lbl=(Label)Master.FindControl("Label1");
Respose.Write(lbl.Text);

//vb
Dim Lbl As New Label
Lbl = CType((Master.FindControl("Label1")), Label)
Response.Write(Lbl.Text)

Thanks,
Sanjay

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 3/17/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

you can use this code

Dim mpLabel As Label

mpLabel = CType(Master.FindControl("masterPageLabel"), Label)
Response.Write( mpLabel.Text)


Thanks

R D Patel

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response