.NET FAQs Unleashed!
 

How to add an event handler for a server control in ASP.NET?

Say we create a server control named btnSubmit. In order to add an event handler to it, see the code below...

'Example in VB.NET Private Sub btnSubmit_Click() Handles btnSubmit.Click
btnSubmit.attribute.add("onclick","javascript:alert('You just added an attribute to the server button control btnSubmit by clicking on it');")
End Sub

1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22