How to: Use the ServerSideValidationExtender Control

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This topic describes how to use the ServerSideValidationExtender control. This control allows ASP.NET developers to invoke existing server-side validators through an asynchronous callback, without performing a full postback to the server. For more information about this control, see ServerSideValidationExtender Control.

Prerequisites

To use the ServerSideValidationExtender, you must have a Web site or Web application project that meets the following conditions:

  • It has been configured to target Microsoft .NET Framework 3.5.
  • It has a reference to the ASP.NET AJAX Control Toolkit 3.5 on the Web site (or in the Web application project).

Steps

The following procedure describes how to use the ServerSideValidationExtender control.

To use the control

  1. In your Web site, add references to the AjaxControlToolkit.WCSFExtensions.dll assembly and the AjaxControlToolkit.dll assembly.
  2. Add the ServerSideValidationExtender control to the Toolbox (this step is necessary only if you do not see the ServerSideValidationExtender control in the Toolbox). To add the ServerSideValidationExtender control to the Toolbox, right-click the Validation tab in the Toolbox, and then click Choose Items. On the .NET Framework Components tab, click Browse, select the AjaxControlToolkit.WCSFExtensions.dll assembly, and then click Open. In the list of components, select the ServerSideValidationControl control, and then click OK.
  3. Drag a ServerSideValidationExtender control to the Web page and set the TargetControlID property to the ID of the validator for which you want to add AJAX capabilities.

Here is an example of what the resulting XML looks like.

<table>
<tr>
<td>
<asp:TextBox ID="AccountNumberTextBox"  Width="320px" MaxLength="50"></asp:TextBox>
</td>
<td>
<cc1:PropertyProxyValidator ID="AccountNumberPropertyProxyValidator" 
ControlToValidate="AccountNumberTextBox" Display="Dynamic" PropertyName="AccountNumber"
SourceTypeName="ValidationQuickStart.BusinessEntities.Profile"></cc1:PropertyProxyValidator>
</td>
</tr>
</table>
<ajaxtoolkitwcsfextensions:ServerSideValidationExtender ID="AccountNumberServerSideValidationExtender"
 TargetControlID="AccountNumberPropertyProxyValidator">
</ajaxtoolkitwcsfextensions:ServerSideValidationExtender>