need a search box by pressing the enter key it should fire server side event

Posted by Ksuresh under JavaScript on 12/30/2011 | Points: 10 | Views : 1427 | Status : [Member] | Replies : 3
Hi,
my requirement is to create a search box with out search button by pressing enter key or magnifier image in that text box it should fire a server side event , i want to pass a search text as Querystring to other page and also when i am clicking in search text box back ground text should remove ...........

Thanks & regards




Responses

Posted by: Sksamantaray on: 12/30/2011 [Member] Silver | Points: 25

Up
0
Down
Refer to:
http://www.dotnetfunda.com/forums/thread7014-after-pressing-enter-key-should-fire-the-buuton-event.aspx
keep your textbox and image button in a div or td having text box without border

Thanks,
Sanjay

Ksuresh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ksuresh on: 12/31/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Sksamantaray ,
<td width="50%">

<input type="text" id="txtSearch" title="Search box" class="searchBox" style="width: 220px; height: 20px;" onkeypress="return IsEnterK(event)" ValidationGroup="ValSearch"/>
</td>


 <script type="text/JavaScript">

function DoSearch() { var q = document.getElementById("txtSearch").value; window.location = "ProductsSearch.aspx?Link=" + q; }
function IsEnterK(e) { var code; if (window.event) { code = window.event.keyCode; } else { code = e.which; } if (code == 13) { DoSearch(); if (window.event) { window.event.keyCode = 0; } else { e.which = 0; } return false; } else { return true; } }</script>
</script>


this is code i am using but it is not working, is there any mistake in this ...
Thanks

Ksuresh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 12/31/2011 [Member] Silver | Points: 25

Up
0
Down
Can you attach your complete code as attachment.
Because current code is working fine for me when i press enter after entering some text.
Please attach a screenshot of your error .

Thanks,
Sanjay

Ksuresh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response