•      Powered by
 

Calling a Button Event from a Code-behind Form

This example demonstrates how to call a button-event using a "Code-Behind forms".
This also can be done using a Compiled DLL.

Webpage code

<%@ Page Inherits="MyCodeBehind" Src="cp.vb" Debug="True" Language="VB" %>

<html>

<head>
<title>New Page 1</title>
</head>

<body>
<form runat="server">
<asp:button id="btn1" text="Button 1" OnClick="b1_Click" runat="server"/>
<asp:button id="btn2" text="Button 2" OnClick="b2_Click" runat="server"/>
<asp:button id="btn3" text="Button 3" OnClick="b3_Click" runat="server"/>
</form>
</body>

</html>

 

Option Strict Off

Imports System
Imports System.DateTime
Imports System.Globalization
Imports System.Data
Imports System.Data.SQL
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls

Public Class MyCodeBehind : Inherits Page
    
    Public Sub B1_Click(Sender As Object, E As EventArgs)
    response.write("B1 was click")
    End Sub
  
    Public Sub B2_Click(Sender As Object, E As EventArgs)
     response.write("B2 was click")
    End Sub


    Public Sub B3_Click(Sender As Object, E As EventArgs)
        response.write("B3<b></b> was click")
    End Sub
End Class
 

tio

Terms of Use | Privacy Statement ©2005-2006 IISLogs.com. All rights reserved - Powered by IIS7 - info @ www.IIS.net