Search code examples
asp.netajaxajaxcontroltoolkit

Validating a textbox with AJAX Toolkit in ASP.NET


I'm not really sure where or what to search for regarding the following question:

I have a TextBox control and a Label control on my page. I have a database query ready and I would like to run it on the TextBox textchanged event in order to display a "valid" or "not valid" text in the Label.

How can I achieve this without posting back the entire page on each textchanged event? I have installed the AJAX Control Toolkit and got the samples working but I don't seem to find an extender that would fit the bill. Any tips? Much appreciated, thank you.


Solution

  • Firstly, move away from the AjaxControlToolkit. This is for lazy web developers who dont know what they are doing.

    Secondly, check out jQuery Ajax. Learn how to use it properly in order to do what you are needing to do.

    Basically what you will need to do is post via jQuery Ajax to your page/webservice in order to run the database query. You can then return your data to the page and update the UI.

    http://api.jquery.com/jQuery.ajax/