tags:

views:

74

answers:

1

Hello All, I am getting the following error while running my MVC Application that consists of the jquery grid plugins. Please help me out

The parameters dictionary contains a null entry for parameter 'page' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult GetCategory(System.String, System.String, Int32, Int32)' in 'ecom.Controllers.AdminController'. To make a parameter optional its type should be either a reference type or a Nullable type. Parameter name: parameters

public ActionResult GetCategory(string sidx, string sord, int page, int rows) { var jsonData = _Category.GetAll().ToJsonForjqGrid("category_id", new[] { "category_id", "category_name" }); return Json(jsonData); }

in the getCategory view i am using in this way

loadProducts();

Thankx in Advance Ritz

A: 

You have an action GetCategory with int parameters, but you don't specify the value for the parameters when you call this action.

As the exception suggests, you should make the int parameters nullable if the parameters are optional and test if the parameter has a value in the action.

public ActionResult GetCategory(string p1, string p2, int? p3, int? p4) 
{
  if (!p3.HasValue)
    throw new ArgumentNullException("p3");
  //etc...
}

If the parameter is not optional, you have an error in the calling code.

Jan Willem B