Alamodgal's suggestion's correct.
The default button property is a very useful feature that can be used to solve your problem.
Just be aware that MsgBox("My message") will not work in an ASP.NET application.
Instead you should have some sort of control (like a Label, or Literal or something) on the page that you can set the text for.
For example, you'd have to add a Label to the Panel:
-
<asp:Panel ID="panel1" runat="server" DefaultButton="first">
-
<asp:TextBox ID="name" runat="server"></asp:TextBox>
-
<asp:Button ID ="first" runat="server" text="First"/>
-
<asp:Button id="second" runat="server" Text="Second"></asp:Button>
-
<asp:Label id="myMessage" runat="server"></asp:Label>
-
</asp:Panel>
And you would set the Label's Text when the button is clicked in the Button Click Event to display which button was clicked:
-
protected void first_Click(ByVal sender As Object, ByVal e As System.EventArgs)
-
{
-
myMessage.Text = "First Button Clicked";
-
}