Click here to Skip to main content
15,898,374 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Friends,

am working on asp.net c#,sqlServer 2005.

am searching data from gridview using textbox and a button...its working fine.

but the problem here is....

after entering text in textbox for searching the data,,am clicking search button to search the data.

So my requirement is after entering the text in textbox, when i press ENTER it should search the data.

Please help me..

Thanks in advance.
Posted

 
Share this answer
 
Refer below link

Text Box Enter Key in ASP.NET[^]
 
Share this answer
 
put the Search button inside Panel and set DefaultButton property of panel to ID of Search button.
XML
<asp:Panel ID="pnl" runat="server" DefaultButton="btnSearch">
    <asp:TextBox ID="txtSearch" runat="server" />
    <asp:Button ID="btnSearch" runat="server" Text="Search" />
</asp:Panel>

now when text entered, press Enter. It will cause Default button i.e. btnSearch to be clicked.

Moreover if u dont want to display Search button, set its display to none.
XML
<asp:Button ID="btnSearch" runat="server" Text="Search" style="Display:None;" />

:)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900