when the text is given in
masterpage.cs file.
label1.text = "hiii";
When i want this label1 text then what should i do?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Feb 17, 2010, 2:24 AM
Suppose you want to change Text Of Label1 on Masterpage then you can change it from child Page Like below Code
ChildPage.aspx
------------------
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
((Label)Master.FindControl("Label1")).Text = "Hello World";
}
}
for getting Text of label 1
//Get Label Text of Label1 in Child Page from master page
string textOnLabel = ((Label)Master.FindControl("Label1")).Text;
Response.Write(textOnLabel);
Amit ChoudharyPosted Feb 17, 2010, 2:28 AM
your problem is not clear. please explain more..