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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Feb 16, 2010, 9:24 PM EST
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 ChoudharyRank #145 · 15.8K reputationPosted Feb 16, 2010, 9:28 PM EST
your problem is not clear. please explain more..