How to call postback using javascript on ASP.NET form
Posted
by Anton
on Stack Overflow
See other posts from Stack Overflow
or by Anton
Published on 2010-04-29T14:53:10Z
Indexed on
2010/04/29
14:57 UTC
Read the original article
Hit count: 470
I have a web form with textbox and button. I want after "ENTER" key click on textbox postbak form.
I am using next code:
onkeypress=" if(event.keyCode==13)
{ alert(2);
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('ctl00$ContentPlaceHolder1$btnSearch', '', true, '', '', false, false));
alert(2);
return false;}
where WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('ctl00$ContentPlaceHolder1$btnSearch', '', true, '', '', false, false));
is javascript code for button event onclick.
I get two alerts, but postback doesnot happen.
Any ideas what is wrong?
© Stack Overflow or respective owner