There are tons of examples for model binding in html forms, but I'm wondering if its possible to, and if so how to, use model binding for ActionLinks/GET requests.
So, given the following model
public class Lurl
{
public string Str {get;set;}
public char Chr {get;set;}
public double Dbl {get;set;}
}
and the following route (I'm not sure how this would be formed; I present it to show how I'd like the URL presents the properties Str, Chr and Dbl)
routes.MapRoute(
"LurlRoute",
"Main/Index/{str}/{chr}/{dbl}",
new
{
controller = "Main",
action = "Index",
lurl = (Lurl)null
}
);
I'd like to use it this way in my Controller
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Index(Lurl lurl)
{
/* snip */
}
and this way in my page (two possible options; are there more?)
<div class="links">
<%Html.ActionLink("Link one", "Index", new { lurl = Model })%><br />
<%Html.ActionLink("Link two", "Index",
new { str = Model.Str, chr = Model.Chr, dbl = Model.Dbl })%>
</div>
Is this possible with the model binding infrastructure? And if so, what needs to be done to my samples to get them working?