This question is locked. New answers and comments are not allowed.
Hello,
is there a way to use routeconstraints with ajaxbinding, without to obtain ugly urls.
For example:
c.Bound( m => m.MyId ).ClientTemplate( Html.ActionLink(
"Ugly"
,
"Action"
,
new
{ id =
"<#=MyId#>"
},
new
{ @
class
=
"t-button"
} ).ToHtmlString() );
Produces: http://localhost:64795/Home/Action?id=1
c.Bound( m => m.MyId ).ClientTemplate(
"<a href='"
+ Url.Action(
"Action"
,
"Home"
) +
"/<#=MyId#>' class='t-button'>Nice</a>"
);
Produces: http://localhost:64795/Home/Action/1
My route:
routes.MapRoute(
"Default"
,
"{controller}/{action}/{id}"
,
new
{ controller =
"Home"
, action =
"Index"
, id =
string
.Empty },
new
{ id = @
"^\d+$"
}
);
Is it correct that the only way is to use the second approach?
Regards,
Timo