c# - onkeyup event asp.net -
hi how can register , call server side event onkeyup event in asp.net textbox.
is possible?
thank you
textbox web control doesn't provide onkeyxxx events instead subscribe ontextchanged event;
<asp:textbox id='textbox1' runat='server' ontextchanged='handletextbox1ontextchanged'> </asp:textbox> public void handletextbox1ontextchanged(object sender, eventargs e) { }
but can provide onkeyxxx behavior client-side.
you can add client-side handler :
textbox1.attributes.add("onkeyup", string.format("onkeyup({0})", textbox1.id));
and in page
`<script language='javascript' type='text/javascript'> function onkeyup(id) { //do something; } </script>`
also use pagemethods make call server-side web methods (static methods) javascript functions.
this link might help.
Comments
Post a Comment