Event / handler

G

Guest

Hi
Here is what I would like to do
- create a web form page with a button control

on the server, or on an inherited assembly
- define the onClick event
- add the onClick event handler to the button Control

How can I do this, please?!

TIA
--
 
K

Ken Cox [Microsoft MVP]

On the server-side, the event is Click.


Public CmdDomain As Button
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim intCounter As Integer
Dim es As System.EventArgs
For intCounter = 0 To 5
CmdDomain = New Button
CmdDomain.Text = "Button" & intCounter.ToString
CmdDomain.CommandName = "Commandname" & intCounter.ToString
CmdDomain.CommandArgument = "Domain" & intCounter.ToString
AddHandler CmdDomain.Click, AddressOf CmdDomainClick
DomainPlace.Controls.Add(CmdDomain)
Next
End Sub
Sub CmdDomainClick(ByVal s As Object, ByVal e As EventArgs)
Dim btnS As Button
btnS = s
Response.Write(btnS.Text)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top