James X.
James X.

Reputation: 87

How to bind a function to "Click" event of a dynamically added ImageButton?

I am completely new to Asp.net.

I am currently working on a asp.net page coded via Visual Basic

On the page I have these image buttons that are dynamically generated based on the SQL Data the page retrieves.

Unfortunately I could not figure out how to bind a click function to each of these buttons.

the [Control Name].onClick = "Function Name()" is for clientSide scripts.

and I need to bind

Protected Sub Button_InsertNewTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button_InsertNewTextBox.Click

to the dynamically allocated buttons.

I couldn't figure out how.

Can anyone help?

Upvotes: 1

Views: 680

Answers (1)

Matthew Steeples
Matthew Steeples

Reputation: 8088

I believe in Visual Basic the AddHandler statement is what you're after

Upvotes: 2

Related Questions