Send complex client objects to server

See how to retrieve values server-side.

JavaScript:

var object1 = new Array();
object1[0] = "Value 10"
object1[1] = "Value 11"

var object2 = new Array();
object2[0] = "Value 20"
object2[1] = "Value 21"
object2[2] = "Value 22"

var parameters = new Array();
parameters[0] = object1;
parameters[1] = object2;
            
ob_post.AddParam('parameters', parameters);
ob_post.post(null, "SendParameters", function(){});


C#

// the method parameter contains a list of "OboutInc.CallbackCollection" elements
// corresponding to "object1" and "object2" from the client side code
public void SendParameters(ArrayList parameters)
{
	// get the first parameter - parameters[0] (=object1)
	OboutInc.CallbackCollection callColl =  (OboutInc.CallbackCollection)parameters[0];

	// get the parameters inside callColl (=object1)
	for (int index = 0; index < callColl.Count; index++)
	{
		string value = callColl.Get(index).ToString();
	}
} 



Download Download this working example.

"I am absolutelly impressed with your suite that’s what makes ASP .net development really effective and fun even for an ASP .net rookie like me."

Szabolcs Apro
Software Consultant