Hi guangming,
I think this is a good question and I can image that.
The other data in ViewModel missing is caused we are using the MapActionFilterAttribute, which only handlers the map information and the extra parameters from ajaxCall method. Some codes in MapActionFilterAttribute like this:
filterContext.ActionParameters["map"] = mapSession;
filterContext.ActionParameters["args"] = objects;
And this maps the action structure like:
[MapActionFilter]
public ActionResult ClictEvent(Map map, GeoCollection args)
So, based on this attribution, we can't get the other models of viewmodel by calling the pre-defined method "ajaxCall". But as an option, we can define another filter attribution to handler the other models in your viewModel, we can define it like :
[AttributeUsage(AttributeTargets.All, AllowMultiple =
true
), Serializable]
public
class
ViewModelActionFilterAttribution : ActionFilterAttribute
{
public
override
void
OnActionExecuting(ActionExecutingContext filterContext)
{
filterContext.ActionParameters[
"others"
] =
"other parameters from viewmodel"
;
base
.OnActionExecuting(filterContext);
}
}
And the action is like:
[MapActionFilter]
[ViewModelActionFilterAttribution]
public
ActionResult ClickEvent(Map map, GeoCollection<
object
> args,
string
others)
{..
}
But the above is just a mocker as I don't what's the way you are calling the action, is it by calling the "ajaxCall" or do the post on the form?
So, it is better you can send us your sample which can mock your project.
Thanks,
Troy