Saturday, June 28, 2008

ValidatorCalloutExtender AJAX Control Example

ValidatorCalloutExtender AJAX Control Example

If you are new to AJAX, Please refer to my Simple AJAX Example to understand how simple to start with AJAX.



Step 1: Add AJAX Script Manager

Step 2: For using ValidatorCalloutExtender, it is not compulsory to add Update Pannel, as this control is extender for validation control, so you must check 1 ValidatorCalloutExtender must associated with 1 Validation Control.

Step 3: Look a sample code to understand how
ValidatorCalloutExtender works

  • Initialize TargetControlID of ValidatorCalloutExtender control with ID of Validation Control you wish to associate with thatz it, nothing more.

<asp:TextBox ID="txtDigit1" runat="server"></asp:TextBox>

<
asp:RequiredFieldValidator ID="rfvDigit1" runat="server" ErrorMessage="Please Enter Digit1" ControlToValidate="txtDigit1" Display="None"></asp:RequiredFieldValidator>
<cc1:ValidatorCalloutExtender ID="rfvDigit1Ext" runat="server" TargetControlID="rfvDigit1">
</cc1:ValidatorCalloutExtender>

<asp:RegularExpressionValidator ID="revDigit1" runat="server" ErrorMessage="Please enter &lt;b>valid Numeric value</b> " ControlToValidate="txtDigit1" Display="None" ValidationExpression="\d{0,15}"></asp:RegularExpressionValidator>
<cc1:ValidatorCalloutExtender ID="revDigit1Ext" runat="server" TargetControlID="revDigit1">
</cc1:ValidatorCalloutExtender>

4 comments:

hongjun said...

The ScriptManager has to be ToolkitScriptManager.

Unknown said...

Nice. Is there any way to validate controls without submit. I mean when control moves to the next text box it should validate the previous one. And how it works with compare validator when you are comparing it with a record from database.

DotNetGuts said...

I seriously recommend using JQuery to do validation and all sort of ajax stuff. Ajax control toolkit is way old and is outdated.

Unknown said...

Can you please provide me any example.

Most Recent Post

Subscribe Blog via Email

Enter your email address:



Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.
Page copy protected against web site content infringement by Copyscape