I have two textboxes in my vb.net web page for type in search criteria.. I want to perform a search when I type in letter into a textbox and when I type in and press an enter key.
I have following javascript to perform a search when I type in to the text box:
<asp:textbox ID = "txt1" runat="server" onkeyup ="DoProcess()" />
its working fine ...Now what I want is I want to perform the same button click event when I type and press the enter key..So I did the following function:
It seems you are burdening the browser and server with your clicks
(is that click performs ajax request? then,)
browser requests keeps burden ur server, before ur browser get responses (for a particular click).
I suggest, use auto-completion (with ajax) for search boxes and use click to fetch searched data.
or block the UI until u get the response from server when u keyUp on textbox.
itsjp
Member
24 Points
103 Posts
javascript textbox enter key event
Nov 25, 2012 07:05 PM|LINK
Hi,
I have two textboxes in my vb.net web page for type in search criteria.. I want to perform a search when I type in letter into a textbox and when I type in and press an enter key.
I have following javascript to perform a search when I type in to the text box:
function DoProcess()
{
document.getElementByID("<%=btn1.ClientID%>").click();
}
<asp:textbox ID = "txt1" runat="server" onkeyup ="DoProcess()" />
its working fine ...Now what I want is I want to perform the same button click event when I type and press the enter key..So I did the following function:
function RunProcess(e)
{
if(e.keyCode == 13) {
document.getElementByID("<%=btn1.ClientID%>").click();
}
}
<asp:textbox ID = "txt1" runat="server" onkeypress ="RunProcess(event)" />
But its not working.............Can anyone please help me.............please...........
h.zahed@live...
Contributor
3171 Points
514 Posts
Re: javascript textbox enter key event
Nov 25, 2012 09:54 PM|LINK
Hi,
Try like this:
var code = (e.keyCode ? e.keyCode : e.which); if(code == 13) { //Enter keycode //Do something }MCP-MCTS-MCPD
Mark the post as Answer, if it helped you in solving your question.
umamahesh202...
Member
164 Points
74 Posts
Re: javascript textbox enter key event
Nov 26, 2012 04:01 AM|LINK
function DoProcess() { var code = (e.keyCode ? e.keyCode : e.which); if(code == 13) { return false } }raju dasa
Star
14412 Points
2452 Posts
Re: javascript textbox enter key event
Nov 26, 2012 05:49 AM|LINK
Hi,
It seems you are burdening the browser and server with your clicks
(is that click performs ajax request? then,)
browser requests keeps burden ur server, before ur browser get responses (for a particular click).
I suggest, use auto-completion (with ajax) for search boxes and use click to fetch searched data.
or
block the UI until u get the response from server when u keyUp on textbox.
rajudasa.blogspot.com || blog@opera
devsolutions
Member
66 Points
24 Posts
Re: javascript textbox enter key event
Nov 26, 2012 06:04 AM|LINK
Refer this link
http://csharpektroncmssql.blogspot.com/2012/05/jquery-keypressonclick-event-in.html
asteranup
All-Star
30184 Points
4906 Posts
Re: javascript textbox enter key event
Nov 26, 2012 08:00 AM|LINK
Hi,
You can try this-
http://delicious.com/anupdg/enter+trigger
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog