Event in code behind file (VB.net) : Button « Asp Control « ASP.Net






Event in code behind file (VB.net)

<%@ Page 
    language=VB 
    debug=true 
    src="EventsInCodeBehind.vb" 
    Inherits="clsEventsInCodeBehind" 
%>
<HTML>
<HEAD>
<TITLE>Inheriting Events in a Code-Behind Files</TITLE>
</HEAD>
<form runat="server">
<BR><BR>
<asp:label
    id="lblMessage1"
    runat="Server"
/>
<BR><BR>
<asp:label
    id="lblMessage2"
    runat="Server"
/>
<BR><BR>
Enter text to uppercase:
<BR>
<asp:textbox
    id="txtUCase"
    runat="Server"
/>
<BR><BR>
Add Numbers:
<BR>
<asp:textbox
    id="txtNumber1"
    runat="Server"
/>
<BR>
<asp:textbox
    id="txtNumber2"
    runat="Server"
/>
<asp:button 
    id="butAdd"
    text="Add"
    runat="server"
/>
</form>
</BODY>
</HTML>

<%--
Public Class clsEventsInCodeBehind
    Inherits System.Web.UI.Page
    Protected WithEvents txtUCase As _
        System.Web.UI.WebControls.TextBox
    Protected WithEvents txtNumber1 As _
        System.Web.UI.WebControls.TextBox
    Protected WithEvents txtNumber2 As _
        System.Web.UI.WebControls.TextBox
    Protected WithEvents lblMessage1 As _
        System.Web.UI.WebControls.Label
    Protected WithEvents lblMessage2 As _
        System.Web.UI.WebControls.Label
    Protected WithEvents butAdd As _
        System.Web.UI.WebControls.Button
    Private Sub Page_Init(ByVal sender As System.Object, _
        ByVal e As System.EventArgs)
        lblMessage1.Text = Date.Now
        txtUcase.AutoPostBack = True
    End Sub
    Private Sub Page_Load(ByVal sender As System.Object, _
        ByVal e As System.EventArgs)
        lblMessage2.Text = Date.Now
    End Sub
    Sub txtUCase_Change(Sender As System.Object, _
        E As System.EventArgs) Handles txtUCase.TextChanged
        Dim TempString as String
        TempString = txtUCase.Text
        txtUCase.Text = TempString.ToUpper()
    End Sub
    Sub butAdd_Click(Sender As System.Object, _
        E As System.EventArgs) Handles butAdd.Click
        butAdd.Text = CSng(txtNumber1.Text) + CSng(txtNumber2.Text)
    End Sub
End Class
--%>
           
       








Related examples in the same category

1.asp:button: command name and arguments (VB.net)
2.Event driven page (VB.net)
3.Set Button text (VB.net)
4.asp:button event to change the label text (VB.net)
5.Button action Command and Parameter (VB.net)
6.Add action listener to a server Button (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"