1
Answer

How to fire button click event dynamically

sachi vasishta

sachi vasishta

13y
2.4k
1
Hi All,

I have a dynamic.aspx.cs file. Here I am generating the button control dynamically. This is the code I have

TableRow trBtn = new TableRow();
TableCell tcbtn = new TableCell();
Button button = new Button();
button.ID = "addNewFault";
button.Text = "Add New Value";
button.Click = "addNewFaultCategory";   // error here. can't initialize like this
tcbtn.Controls.Add(button);
trBtn.Cells.Add(tcbtn);
tb1Addbtn.Rows.Add(trBtn);

I want to know how to fire the click event on click of the button "AddNewValue".
Answers (1)