I have a button which needs to get created dynamically but the problem is I cannot set the OnClick property of it for it to run the server side method btnSubmit_Click(object sender, EventArgs e)
If I do:
btnSubmit.Attributes["OnClick"] = "btnSubmit_Click()";
it actually adds it to the OnClientClick instead.
btnSubmit.Click += new EventHandler(btnSubmit_Click);
also never fires.
How can I set the actual server OnClick?
Bind event in Page_PreInit
Add this event.