I have used Ajax Page Method to call a server side Method for verifying value in textbox.Here is my Code
Javascript Code :
function VerifyValue()
{
var txtCtrl= document.getElementById('<%= txtCode.ClientID %>');
PageMethods.VerifyValue(txtCtrl.value,onComplete,onFailure,txtCtrl);
}
// Server side method VerifyValue is returning string and executing properly.
// Getting called perfectly and returns 'N'
function onComplete(result,txtCtrl)
{
if (result == 'Y')
{
alert("Vsuccessfully");
}
else if (result == 'N') // Control goes here
{
[COLOR="Red"] txtCtrl.value = " "; // Here is the problem,
// textbox not getting updated[/COLOR]
alert("Invalid value!" ); // alert Message is fired perfectly.
}
}
My problem is txtCtrl value which I am setting in 'else' condtion is not getting updated to " ",it remains unchanged.No error is thrown during execution.Please help me urgently.