Ну, вы можете поместить одно и то же событие для обеих кнопок, примерно так:
<asp:Button ID="btn1" runat="server" Text="Button 1" CommandName="Save" />
<asp:Button ID="btn2" runat="server" Text="Button 2" CommandName="Cancel" />
и в коде позади (vb.net):
Protected Sub btn_event(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn1.Click, btn2.Click
Dim btn As Button = CType(sender, Button)
'now you have the button instance on sender object, and you can check the ID property or CommandName property do solve what you want to do!
End Sub
Код C #:
protected void btn_event(object sender, EventArgs e) {
Button btn = (Button)sender;
//now you have the button instance on sender object, and you can check the ID property or CommandName property do solve what you want to do!
}
Если вы используете C #, не забудьте установить событие, нажмите на кнопку asp: tag.