在文本框中输入文本后搜索数据 [英] Search the data after entering the text in textbox
问题描述
亲爱的朋友,
正在使用asp.net c#,sqlServer2005.
我正在使用文本框和按钮从gridview搜索数据...工作正常.
但是这里的问题是....
在文本框中输入用于搜索数据的文本后,单击搜索按钮以搜索数据.
所以我的要求是在文本框中输入文本后,当我按Enter时,它应该搜索数据.
请帮帮我..
在此先谢谢您.
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.
推荐答案
请将此 ^ ]
请参阅下面的链接
文本框在ASP.NET中输入密钥 [
Refer below link
Text Box Enter Key in ASP.NET[^]
将搜索"按钮放在面板内,并将面板的DefaultButton属性设置为搜索"按钮的ID.
put the Search button inside Panel and set DefaultButton property of panel to ID of Search button.
<asp:Panel ID="pnl" runat="server" DefaultButton="btnSearch">
<asp:TextBox ID="txtSearch" runat="server" />
<asp:Button ID="btnSearch" runat="server" Text="Search" />
</asp:Panel>
现在,当输入文本时,按Enter键.这将导致点击默认按钮,即btnSearch.
此外,如果您不想显示搜索"按钮,请将其显示设置为无".
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.
<asp:Button ID="btnSearch" runat="server" Text="Search" style="Display:None;" />
:)
这篇关于在文本框中输入文本后搜索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!