0

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..

3
  • that error message seems to be talking about the SelectedID, which looks ok. But your Mode seems completely wrong. Are you sure thats the error your getting? Mode is an int, DataManager is not an int Commented Apr 23, 2014 at 14:57
  • If mode is enum, declare it as enum type, not as int Commented Apr 23, 2014 at 15:01
  • @Liam, archil, sorry I corrected it before hand but forgot to reflect in the url that I submitted here. But the real issue was with the Int range and it is solved with WeTTTT's help Commented Apr 23, 2014 at 15:17

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.