Add action listener to a server Button (VB.net) : Button « Asp Control « ASP.Net






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

1.Event in code behind file (VB.net)
2.asp:button: command name and arguments (VB.net)
3.Event driven page (VB.net)
4.Set Button text (VB.net)
5.asp:button event to change the label text (VB.net)
6.Button action Command and Parameter (VB.net)
7.asp button postbackurl (C#)
8.asp button on client click (C#)
9.Button counter: click and change button label (C#)
10.Add action listener to asp Button by delegate (C#)
11.Read input and do the calculation in Button action listener (C#)
12.Button event Handler (C#)
13.onmouseover and onmouseout events
14.OnClientClick event
15.CausesValidation="False"