RadAjax for ASP.NET

Cancel AJAX request Send comments on this topic.
See Also
How-to > Cancel AJAX request

Glossary Item Box

You can cancel an AJAX request in a client-script function simply by returning value false. The client-script function can be called upon OnRequestStart event.

JavaScript Copy Code
function CheckZipCode()
{
 var zipCode = document.getElementById('<%=TextBox1.ClientID%>').value;
 if (zipCode.length != 5)
 {
  alert('Please enter a valid 5 digit postal code!');
  return false; // cancel the AJAX request
 }
 else
 {
  var fiveDigitCheckRE=/^\d{5}$/ //regular expression for checking a 5 digit number
  if (zipCode.search(fiveDigitCheckRE) == -1)
  {
   alert("Only digits are allowed!"); return false; // cancel the AJAX request
  }
 }
}
You can also check this example out:

http://localhost/Telerik/Telerik RadAjax1.0_NET2/Ajax/Examples/Common/CancelAJAX/DefaultCS.aspx

See Also