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


Top 5 Contributors of the Month
david stephan

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

validator callout extender

Posted By: sriram     Posted Date: October 08, 2009    Points:2   Category :ASP.Net
iam using customvalidator with validatorcalloutextender. i'm changing the errormessage of the cusomvalidator based on different conditions using javascript function. but the errormessage is not changing. whatever the value that is given for errormessage attribute , that one only displaying. Even the text box value is < 3000 or > 5000, always 'test1' is only displaying in validatorcalloutextender, instead it should display test2, if the value in textbox is less than 3000, and should display test3 , if its greater than 5000.

<asp:CustomValidator ID="cv_RC_ValidTotQty" runat="server" ErrorMessage="test1"
ControlToValidate="txtTotalQty" ClientValidationFunction="validateTotalQtyForRC" Display="None" ValidateEmptyText="true" SetFocusOnError="true" ValidationGroup="Submit"></asp:CustomValidator>
<ajaxToolkit:ValidatorCalloutExtender id="vceValidRCTotalQty" runat="server" TargetControlID="cv_RC_ValidTotQty" ></ajaxToolkit:ValidatorCalloutExtender>

function validateTotalQtyForRC()
{
if(parseInt(totQty) < 3000)
{
oSrc.errormessage = "test2";
args.IsValid = false;
}
else if(parseInt(totQty) > 5000)
{
oSrc.errormessage = "test3";
args.IsValid = false;
}
}

Responses
Author: Rahul             
Posted Date: October 08, 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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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