Find Controls of MasterPage inside Web Control

Write this code on button click event :

protected void Button1_Click(object sender, EventArgs e)

{
    Control ctl = this.Parent;

    String name = (ctl.Page.Master.FindControl("txtName") as TextBox).Text;

}

 

Ebook Download
View all
Learn
View all