I’ve got an <input type='image'> in an ASP.NET MVC view, but I’m not sure how to retrieve the coordinates in the action that runs when the form is submitted. The requested URL looks like
/Map/View/?map.x=156&map.y=196
but I can’t just do
public ActionResult View( int map.x, int map.y )
{
...
}
because they’re obviously not valid names for C# method parameters. Is there any equivalent of the ActionName attribute to map query parameters to method parameters?
You have to use use Model binder and set the prefix property to “map”:
First create the Model object:
And in your action method: