ThinkGeo.com    |     Blog    |     Wiki    |     Support

Shapefile click event

If we serialize an object client side and send to the server using ajaxCallAction, we then get the objects in the server side MapAction via GeoCollection args. Instead of getting each object by index like args[0].ToString(), is it possible to get the objects via strongly typed like args.MyObjectProperty? Would we need to do something like this? GeoCollection args

Hi,

I don’t understand this reply, so what’s the question here?

Regards,

Ethan

Sorry my full question didn’t send because it had <> symbols in it…
If we serialize an object client side and send to the server using ajaxCallAction, we then get the objects in the server side MapAction via GeoCollection(obj) args. Instead of getting each object by index like args[0].ToString(), is it possible to get the objects via strongly typed like args.MyObjectProperty? Would we need to do something like this? GeoCollection(MapViewModel) args

Hi Jmarshall,

You can refer this topic: Pass two parameter throw ajaxcallaction

It looks you can also get the value by its key.

And if your target is more complex like: GeoCollection(MapViewModel), you can try to test it, but I think it should won’t works because the GeoCollection should be JSON format.

Regards,

Ethan

How do we get the property names to send server action? If we have { LocationName: “this is a test”, LocationNumber: 6 } passed to action, in the action method we only have index and value like 0 : this is a test. How do we send the property name to controller action?

Hi Jmarshall,

It looks in this API you cannot get the key for example “LocationName”, you can just know index of it.

And please make sure the key in client side is different.

In fact I think you can put the key in value like this(you can choose other delimiter):
{0: LocationName_xxx, 1: LocationNumber_6}

And in server side, loop and split them to know what it is.

Regards,

Ethan

This seems extremely limited. What if we have a hundred properties that we want to display in our view with thousands or rows/records, how can we possibly send those to the server and manage that data server side with indexing? It seems this MVC product is very lacking if it can’t even handle strongly typed view models, one of the cornerstones of good MVC development. We need more options to pass data to server.

Hi Jmarshall,

It’s not designed to pass big data back to server side, map need to pass necessary data itself. If you want to do extra data operation, you should want to implement that by custom code but not via map.

And in fact you can try to implement it by a simple custom function just like my suggestion. Loop the parameters, split by special delimiter and get the information you want.

We still thanks your suggestion about our product, maybe we will provide some helper function for pass the data in future.

Regards,

Ethan