see my url localhost:55831/Customers/Edit/1/ALFKI
which i generate using @Html.RouteLink
@Html.RouteLink("Edit", "PageWithId",
new
{
controller = "Customers",
action = "Edit",
id = item.CustomerID,
page = ViewBag.CurrentPage
})
here is my routing code for PageWithId i tried two routing one after one but none work
routes.MapRoute(
name: "PageWithId",
url: "{controller}/{action}/{page}/{id}"
);
AND
routes.MapRoute(
name: "CustomerEditWithId",
url: "Customers/Edit/{page}/{id}",
defaults: new { controller = "Customers", action = "Edit" }
);
my all routing code
routes.MapRoute(
name: "PageWithSort",
url: "{controller}/{action}/{page}/{SortColumn}/{CurrentSort}",
defaults: new { action = "Index", page = UrlParameter.Optional, SortColumn = UrlParameter.Optional, CurrentSort = UrlParameter.Optional }
);
routes.MapRoute(
name: "PageWithId",
url: "{controller}/{action}/{page}/{id}"
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
please some one help because when i am clicking ob this link localhost:55831/Customers/Edit/1/ALFKI then customer id ALFKI is not passing to edit action. i debug the edit action code and found id is getting null always. i tried few routing for edit action but no luck still.