Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I want to pass Custom Class Object in Web method(on my code behind) in asp.net using javascript on click of img tag(which is in dynamically created div) .But i am getting problem in it. and getting following error:

"Invalid web service call, missing value for parameter: 'ord'."

Here is my Code:

@"<div class=slctd_prod><div><span class=extra_info><img alt='img not found' src='Theme/img/CancelOrder1.jpg' id='Img2' onclick='GetMessage(" + currOrder + @" );return false;'/></span></div>


in above code "CurrOrder" is my custom class object. which is having multiple properties.

and My javascript function look like this:

<script type=text/javascript>;
function GetMessage(abc) {

PageMethods.Message(abc,OnGetMessageSuccess, OnGetMessageFailure);
}
function OnGetMessageSuccess(result,userContext, methodName) {
alert(result);
}
function OnGetMessageFailure(error, userContext, methodName) {
alert(error.get_message());
}
and My code behind function in .aspx.cs file is look like this:

C#
public static void Message(cOrder ord)
   {

       // my code

}

and please do not suggest me to use Jquery or JSON for this. because i don't want these things.

Please any one can help me!
Thanks in Advance.
Posted
Updated 3-Apr-12 20:23pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900