ASP.Net MVC routing issue with parameters

This is my Action method:

public ActionResult Index(int SelectedID, int mode)
{
    ViewModel viewModel = new ViewModel();
    viewModel.SelectedID = SelectedID;
    viewModel.Mode = mode;
    return View(viewModel);
}

This is how I call it:

localservername/DManager/DManager/Index?SelectedID=9306270318&Mode=DataManager

And I am getting the following error:

The parameters dictionary contains a null entry for parameter 'SelectedID' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Index(Int32, Int32)' in 'MscanES.Web.Areas.DManager.Controllers.DManagerController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters

Clueless..


C# int (Int32) range is -2,147,483,648 to 2,147,483,647 . Your number 9,306,270,318 is obviously over the range, use Int64 instead.

链接地址: http://www.djcxy.com/p/39228.html

上一篇: ASP.NET MVC 5生成正确的URL但执行错误的操作

下一篇: 带有参数的ASP.Net MVC路由问题