Thanks Michael
That works great.
Michael Schwarz wrote:
> Hi,
>
> use following code on the server-side AjaxMethod:
>
>
> [AjaxMethod]
> public static void MyMethod(AjaxPro.IJavaScriptObject o)
> {
>
> }
>
>
> If o is of type AjaxPro.JavaScriptObject you can use it as something
> similar to a Hashtable. There are
> JavaScriptString/Boolean/Number/Array available.
>
> Regards,
> Michael
>
>
>
>
>
> On 11/15/06, David McCollough <[EMAIL PROTECTED]> wrote:
> >
> >
> > Please excuse me if the answer to this question is obvious or has been asked
> > before.
> >
> > I did some searching prior to posting this and could not find an answer.
> >
> >
> >
> > I would like to create an object in Javascript and pass it to a server-side
> > AjaxMethod
> >
> > and in the server side method be able to access the data in it like it was
> > an object.
> >
> >
> >
> > I have tried doing this:
> >
> >
> >
> > <script>
> >
> > function someFunction()
> >
> > {
> >
> > var myObject = new Object();
> >
> >
> >
> > myObject.Value1 = "1";
> >
> > myObject.Value2 = "2";
> >
> >
> >
> > PageClassName.getSomeData(myObject);
> >
> > }
> >
> >
> >
> > [AjaxMethod]
> >
> > public void getSomeData(object theObject)
> >
> > {
> >
> > ...
> >
> > // I would like to be able to reference the data here like
> >
> > // theObject.Value1
> >
> > }
> >
> >
> >
> > When I use the debugger and place a break point in the AjaxMethod, the
> > object is their
> >
> > but it appears to be one long string.
> >
> >
> >
> > So I guess my question is how can I create a javascript object, pass it to a
> > server side
> >
> > Ajax Method and use it like an object in the server side method ?
> >
> >
> >
> > Thanks
> >
> >
> >
> > David
> > >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>
> --
> Best regards | Schöne Grüße
> Michael
>
> Microsoft MVP - Most Valuable Professional
> Microsoft MCAD - Certified Application Developer
>
> http://weblogs.asp.net/mschwarz/
> http://www.ajaxpro.info/
> http://www.thumboo.com/
>
> Skype: callto:schwarz-interactive
> MSN IM: [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info/
Don't forget to read my blog at http://weblogs.asp.net/mschwarz/
The open source project is now located at
http://www.codeplex.com/Wiki/View.aspx?ProjectName=AjaxPro
-~----------~----~----~----~------~----~------~--~---