Problem with creating Grid Control

Jul 15, 2011 at 1:16 PM

Hi! I want to create Grid Control like it was in the example.

I've done all the same, but I have this error:

The parameters dictionary contains a null entry for parameter 'page' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult GridList(Int32, Int32, System.String, System.String)' in 'MvcApplication4.Controllers.TopicController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters

How can I fix it?

Jul 15, 2011 at 1:25 PM


Could you post your controller action?

And please look at the example project for up to date code samples - I'm sorry but the tutorial in the documentation tab is out dated (I'll update it in the next couple of days)

Jul 15, 2011 at 1:52 PM

Ok. Now I'm trying to do like in MVC.Controls.Examples from there  Is it up to date?


 public ActionResult List(SearchModel searchModel)
TopicRepository repository = new TopicRepository();

List<Product> products = repository.ListAll();

var model = products.AsQueryable();
return Json(model.ToGridData(searchModel, new[] { "Id", "Name", "CompanyName", "Price" }), JsonRequestBehavior.AllowGet);

@using MVC.Controls.Grid

@Html.Grid(new GridControl().SetName("grid")
.SetColumns<MvcApplication4.Models.Product>(cs =>
                cs.Add(x => x.ProductId).SetAsPrimaryKey();
                cs.Add(x => x.Name);
                cs.Add(x => x.CompanyName);
                cs.Add(x => x.Price);

And now I have such error:

Object reference not set to an instance of an object.


Jul 15, 2011 at 2:37 PM

Can you post the full stack-trace so we could try and find the source of the error?