Add action listener to a server Button (VB.net)
<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
lblMessage.Text = "Press a button!"
End Sub
Sub SubmitBtn1_Click(Sender As Object, E As EventArgs)
lblMessage.Text = "You pressed the alone button."
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Button Controls Sample Page</TITLE>
</HEAD>
<BODY>
<form runat="server">
<Font Face="Tahoma" Size="+1">
<asp:Label
id="lblMessage"
Text="Press a button!"
runat="server"
/>
<BR><BR>
<asp:Button
id="butAlone"
text="Alone Button"
OnClick="SubmitBtn1_Click"
runat="server"
/>
<BR><BR>
</Font>
</Form>
</BODY>
</HTML>
Related examples in the same category