tags:

views:

291

answers:

2

How can a program capture generates events from a dynamically created button control in asp.net?

+2  A: 

You can attach the event programmatically:

Button myButton = new Button();
myButton.Click += new ClickEventHandler...etc
FlySwat
A: 

Button ButtonDeleteFromDB = new Button();

ButtonDeleteFromDB.Text = "Delete";

ButtonDeleteFromDB.ID = "btnDeleteFromDB" + ctrlCount.ToString();

ButtonDeleteFromDB.Click += new EventHandler(ButtonDeleteFromDB_Click);

Call the event in foll manner :

private void ButtonDeleteFromDB_Click(object sender, EventArgs e) { }

Samiksha