如何在没有任何按钮的情况下在ASP.NET的文本框中调用enter事件

如何在没有任何按钮的情况下在ASP.NET的文本框中调用enter事件

问题描述:

我在asp.net中真的很新,我不知道如何使用输入事件在没有任何按钮或单击按钮的情况下捕获文本框中的值。



我尝试了什么:



i尝试将其置于面板内并将搜索按钮设为默认但我不想要任何按钮,因为它会影响我的ui,我需要一个简单的无按钮。



i really new in asp.net i don't know how to capture the value in a textbox using enter event without any button or click buttons.

What I have tried:

i tried putting this inside of a panel and make the search button as a default but i dont want any button because it will affect my ui, i need a simple no buttons please.

Search :
                           <asp:TextBox ID="txtSearch" runat="server" ValidationGroup="search" Width="167px"></asp:TextBox>
                            
                           <asp:Button ID="btnSearch" runat="server" ValidationGroup="search" OnClick="btnSearch_Click" Text="Search" />

看一下onTextChanged事件
Take a look at the onTextChanged event