This is my actionlink
@Html.ActionLink("Details", "Details", new { id = item.WarehouseID })
It gives me this link http://localhost:6587/WareHouse/Details/1.00000000
The Controller
public ActionResult Details(decimal? id)
{
Warehouse Warehouse = db.Warehouse.Find(id);
return View(Warehouse);
}
when I change the action link to
@Html.ActionLink("Details", "Details", new { WareHouseID = item.WarehouseID })
And retrieve the link as queryString it works well
public ActionResult Details(decimal? WareHouseID)
{
Warehouse Warehouse = db.Warehouse.Find(WareHouseID);
return View(Warehouse);
}
But as id it gives me
HTTP Error 404.0 - Not Found
I tried to trace it by debugging
but it not step into details actionResult with that link
http://localhost:6587/WareHouse/Details/1.00000000
my route config
using System.Web.Routing;
namespace TestErp
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}