c# - How to create onclick event in .cs file for html <Input> Tag? -
how create onclick event in .cs
file asp.net c# html tag ?
example :-
< input type="button" id="btnbeforeok" value="ok" name="btnbeforeok" style="width: 90%;" />
i want create event in .cs
file how can ?
or
bool isemail = regex.ismatch("nikunj@yahoo.com", @"\a(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[a-z]{2}|asia|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel)\b)\z", regexoptions.ignorecase);
the above bool isemail want in .aspx
page ?
very simple.
html:
<input type="button" id="btnbeforeok" value="ok" runat="server" name="btnbeforeok" style="width: 90%;" />
now go html view of page , double click on button, generate event , button markup changed below:
<input type="button" id="btnbeforeok" value="ok" runat="server" name="btnbeforeok" style="width: 90%;" onserverclick="btnbeforeok_serverclick" />
and can find below event in code behind:
protected void btnbeforeok_serverclick(object sender, eventargs e) { response.write("hello"); }
i hope helps!