Hi
If you want to assign a child method to a master page control, then do it at runtime. Otherwise the master is tightly coupled with the child.
For example the master page has a button and the child page has a text box. When the master page button click then it has to populate the child text box.
at the child page...
protected void Page_Load(object sender, EventArgs e)
{
Button button1 = (Button)this.Master.FindControl("Button1");
button1.Click += new EventHandler(button1_Click);
}
protected void button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "I am calling this from Master";
}
Here the master page doesn't know at design time which method has to call. So it is not tightly coupled to a child page. When the child page is loading you are telling a master page control 'do this'. In that way you can use any child can bind to master control.
Steps involved.
1) Find the master control using
Master.FindControl
method
2) Assign an event handler( a delegate) which is present in the content page.
Hope this helps