Say you have a situation like this:

Here you see we have a master/content page scenario with the content page containing an UpdatePanel and the master page containing a ScriptManager. If you look at the bottom of the master page, you'll also see a LinkButton creatively named "LinkButton". Within the UpdatePanel on the content page, you'll see a Label.
What we want to do is handle the LinkButton click event asynchronously (through ASP.net AJAX) so that the Label within the UpdatePanel on the content page refreshes seamlessly. The catch, however, is that you want to centralize all your code for handling the click event from within the ContentPage. How would you do this?
First, within the Page_Load event for the MasterPage control, you would do this:
protected void Page_Load(object sender, EventArgs e)
{
this.ScriptManager1.RegisterAsyncPostBackControl(
LinkButton1);
return;
}You see here that we're registering the LinkButton with the ScriptManager control as one that should generate asynchronous postbacks. We then publicize the LinkButton by actually creating an accessor property for it directly within the code for the MasterPage as follows:
public LinkButton MyLinkButton
{
get
{
return LinkButton1;
}
}This let's us interact with the LinkButton on the master page strongly (as opposed to using the FindControl method and locating it "weakly" or by name).
The Page_Load event for the content page, then, will look like this:
protected void Page_Load(object sender, EventArgs e)
{
MasterPage mp = (MasterPage)this.Master;
mp.MyLinkButton.Click += new EventHandler(OnButtonClick);
}We grab a reference to the MasterPage object and type it to our particular variant on the MasterPage class (remember we have modified it to have the MyLinkButton property above). Once we have a valid reference, we use the MyLinkButton reference to grab a reference to the LinkButton itself and register an event handler for its click event from within our ContentPage.
We then actually write the event handler within the ContentPage itself:
private void OnButtonClick(Object sender, EventArgs args)
{
this.Label1.Text = DateTime.Now.ToString();
return;
}The result is a control on the MasterPage firing an asynchronous postback event that is then handled properly from the ContentPage (the arrow in the picture points to the region that was asynchronously updated):

Recommended reading:
