如何使用数据库检查文本框中的每个条目

如何使用数据库检查文本框中的每个条目

问题描述:

我希望文本框中的每个条目都应该与table一起检查。有没有可能使用asp.net或ajax中的任何工具。

i在代码中尝试过,但是它需要一些时间来检查。



i想要为这个文本框设置验证。



谢谢,

i want each entry in a textbox should check with table.is there any possible to use any tool in asp.net or ajax.
i was tried in code ,but its take some time to checkout.

i want to set the validation for this textbox.

Thanks,

我这样做了,需要一些时间才能加载...
i did that,its take some time to load ...


你可以在Textbox的TextChanged事件中处理它。类似下面的代码。

You can handle it inside the TextChanged event of the Textbox . Something like the below code .
<asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>





Code Behind:





Code Behind :

protected void TextBox1_TextChanged(object sender, EventArgs e)
        {
           //Do your input checking with  a DB Call
        }





如果要在Clientside / Ajax中检查相同内容,可以查看本文作为参考



http ://www.aspsnippets.com/Articles/Check-Username-Availability-in-ASP.Net-using-AJAX-PageMethods.aspx [ ^ ]





希望这有助于......



You can check this article as a reference if you want to check the same in Clientside/Ajax

http://www.aspsnippets.com/Articles/Check-Username-Availability-in-ASP.Net-using-AJAX-PageMethods.aspx[^]


Hope this helps...