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 <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:
The ScriptManager has to be ToolkitScriptManager.
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.
I seriously recommend using JQuery to do validation and all sort of ajax stuff. Ajax control toolkit is way old and is outdated.
Can you please provide me any example.
Post a Comment