'Abbiamo un updatePanel1 


<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional">
  <ContentTemplate>
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
    <asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px">
    </asp:Panel>
  </ContentTemplate>
</asp:UpdatePanel>
</div> 


'a runtime aggiungiamo dinamicamente due pulsanti button1, button2 nel Panel1


LinkButton button1 = new LinkButton();
button1.ID = "button1"
button1.Text = "button1" 

LinkButton button2 = new LinkButton();
button2.ID = "button2"
button2.Text = "button2" 

Panel1.Controls.Add(button1);
Panel1.Controls.Add(button2); 



'ora intercettiamo quale pulsante  stato cliccato con l'utilizzo dell'ogggetto Request 

protected override void CreateChildControls()
{ 
  base.CreateChildControls(); 
  if( ScriptManager1.IsInAsyncPostBack )
  {
    string fromWhere = Request[ScriptManager1.ID];
    Label1.Text = fromWhere;
  }
}
 

'Ecco il risultato

On Button1 click: UpdatePanel1|button1
On Button2 click: UpdatePanel1|button2



'Abbiamo l'ID dell'UpdatePanel el' ID del pulstante che ha scatenato l'evento

'cosi possiamo procedere in questo modo



protected override void CreateChildControls()
{ 
  base.CreateChildControls(); 
  if( ScriptManager1.IsInAsyncPostBack )
  {
    string fromWhere = Request[ScriptManager1.ID];    
    if( fromWhere.Contains("button1") )
    {
        //Do something here
    }
    else if (fromWhere.Contains("button2")
    {

        //Do something else....as you wish....
    }
  }
}

