.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

problem with ValidatorCalloutExtender

Posted By: sriram     Posted Date: October 26, 2009    Points:2   Category :ASP.Net
i've 2 textboxes called, comments and amount and 1 submit button, if amount> 5000, i have to display some warning message as comments is required over comments textbox using ValidatorCalloutExtender.
when i tried this as below, validation is not firing, event amount > 5000

<textarea id="txtareaComments" name="textareaComments" rows="5" cols="90" runat="server" ></textarea>
<asp:CustomValidator ID="cvComments" runat="server" ErrorMessage="Please Enter Comments" ControlToValidate="txtareaComments" ClientValidationFunction="validateComments" Display="None"
SetFocusOnError="true" ValidationGroup="Submit">
<ajaxToolkit:ValidatorCalloutExtender ID="vceComments" runat="server" TargetControlID="cvComments">

function validateComments(sender, args)
var expected = document.getElementById('ctl00_ContentPlaceHolder1_txtExpected').value;

if(parseInt(expected) > 0 )
args.IsValid = false;

args.IsValid = true;


Author: Rahul             
Posted Date: October 26, 2009     Points: 5   

Hi try like this

sender.errormessage = "Your message";
var cell = sender.ValidatorCalloutBehavior._errorMessageCell;

if (cell != null)
cell.innerHTML = "Test Message";

Also send the object at the client side using this keyword when you are calling the javascript function from custom validator

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend