Here is another way to get the Route Data. This is useful when calling another Action on Another controller and passing values.
Example Route:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller="Home", action="Index", id=UrlParameter.Optional}
);
Controller:
public ActionResult Index(int id)
{
int val2 = id;
int val1 = Routedata.Values["id"];
}
Share This To :
0 comments:
Post a Comment