Tuesday 2 April 2013

How to access the content page control from master page click event ?


How to access the content page control from master page click event ?


masterpage
Hi
One time, i was asked this question in one of my interview “How to access the content page control from master page click event ?”
here is the exact answer, we can access the content page from master page click event using Findcontrol like this
protected void btnClick_Click(object sender, EventArgs e)
{
TextBox txtbox1 = (TextBox)ContentPlaceHolder1.FindControl(“Textbox1″);
if (txtbox1 != null)
{
txtbox1.Text = “Content Textbox”;
}
}

No comments:

Post a Comment