JasonBunting schrieb:
> So, are you just going to ignore my follow-up questions and comments? I
> really think you should address this issue - sending a simple
> JavaScript array back to the server should easily translate to a .NET
It is no Problem for Ajax.NET Pro to convert JavaScripts array back to
Server, if on the server side the type es defined. With XmlHttpRequest
only a string with chars is passed to the server, without some
information of the type it is not possible to converting something in
something special.
// client
var values=[1,4,14,15];
PageMethods.DoMagic(values, theCallback);
function theCallback(res)
{
alert(res.value); //no error check in the example
}
// server
public class PageMethods
{
public int DoMagic(int[] values)
{
int sum = 0;
foreach (int value in values)
{
sum+=value;
}
return 0;
}
}
// back to text
I think it makes no sense to make conversion on a good guess an TryParse
everything possible. With the right type defined of the server case,
there is not need for that.
In your case, you should use.
public int DoMagic(List<int[]> values)
{
int sum = 0;
foreach (int[] v in values)
{
foreach (int value in v)
{
sum += value;
}
}
return sum;
}
Works greats.
--
Freundliche Grüße
Albert Weinert
http://der-albert.com
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---