Reputation: 25
I have a master page in that page i want to show the user name in a label . but i want to pass the value on that label from .cs page. My page is also connected to the master page. please help me how can i do that.
Upvotes: 1
Views: 178
Reputation: 88
You can use Sessions... Session["Session Name"]= someValues; You can assign a value to session and show it on master page with the help of textbox or lbl etc
Upvotes: 0
Reputation: 1264
You can try with the below code in your content page.aspx.cs.
protected void Page_Load(object sender, EventArgs e)
{
Label lblMasterPage= this.Master.FindControl("lblMasterPage") as Label;
lblMasterPage.Text = "Setting Label from Content Page";
}
Note : use your master page label id instead of lblMasterPage.
Hope this helps!
Upvotes: 1