I am rendering some html in code behind using StringBuilder which includes a button. I am also trying to add a handler to this and I think perhaps not surprisingly it does not fire. Can I include an event handler to a button in this way?
sb.Append("<td>");
sb.Append("<input type='button' runat='server' id='butResetPassword' value='Reset Password' onserverclick='butSendEmail_Click' />");
sb.Append("</td>");
User.InnerHtml = sb.ToString();
this is the eventhandler that appears in the same code behind page
protected void butSendEmail_Click(object sender, EventArgs e)
{
labTester.InnerText = "Thanks for clicking me";
}