views:

513

answers:

2

I have a javascript call to a C# WebMethod. The same page has another call and it is working. I debugged the javascript code, this is called:

function userUpdReq_onOk()
{
...
var clientValidationPassed =Page_ClientValidate();

if( clientValidationPassed )
{
PageMethods.RequestUserUpdate(username, email, sex, zipCode, state, city, neighborhood, address, addressNumber, addressComplement, phone, promotionalInfo, connectionType, connectionSpeed, userUpdReq_OnComplete, userUpdReq_OnError);
}
...
}

The debugger passes by this line, but the next method it enters is userUpdReq_OnError( ). Why does it happen?

+2  A: 

What is the message in error argument passed to userUpdReq_OnError()?

The OnError method is called when an error occurs inside of your page method. Sometimes this will be a casting issue, or a server error for some other reason. The error message passed to your OnError method should be able to guide you to the reason for the failure.

To get the error message, you can define the error handler as follows:

function userUpdReq_OnError(error){}

The error parameter will have a message indicating the reason for the failure.

Jay S
where do I see the message? OnError does not have a parameter defined to receive arguments. I debugged the PageMethod call, and it does many loops to some code to verify the parameters, I didn't achieve the end of this process yet.
Victor Rodrigues
You can define the error handler as follows: function userUpdReq_OnError(error){}You should be able to get the error message back this way.
Jay S
Thanks, I've done it and found a casting error.
Victor Rodrigues
I'm glad that worked!! I've added the function declaration to the answer in case it helps anyone else.
Jay S
A: 

Here is another issue "innocent" I think but it givme a lot troubbles, however, for some unknown reason, in some place aspx lost some reference to ScriptManager, so, what we must do to fix it is remove ScriptManager from aspx, add it again and set EnablePageMethods located in properties window to true.

Reggards.

Edwar