How can i add a asp button with onclick events in a table cell programatically?
This is what i have tried.
TableCell tbBtn = new TableCell();
Button bt = new Button();
bt.Text = "Add Books to Database";
bt.ID = (count++).ToString();
bt.Click += new EventHandler(btnAddBook);
tbBtn.Controls.Add(bt);
But when the page is loaded, the button was a input type="submit" and it does not have a onclick event at all.
Here is the view source of the button
<input type="submit" name="ctl00$ContentPlaceHolder1$0"
value="Add Books to Database" id="ContentPlaceHolder1_0">
How can i make the button to be like an ASP button to runat server and to be able to execute a function when on clicked.
Cheers.
btnAddBookwas triggered?