This project is read-only.

Binding to Webgrid issue

May 17, 2013 at 1:19 PM
Hi All,

I am new to MVC and trying to solve an issue

My requirement is that I need to enter some data in the first view and then populate

the webgrid in the second view with the values entered in the first view.

the code in my first view's controller is as follows

public ActionResult DisplayBooking()


Customer cust = new Customer();

cust.FirstName = Request.Form["FirstName"].ToString();

cust.LastName = Request.Form["LastName"].ToString();

cust.ContactNumber = Convert.ToInt32(Request.Form["ContactNumber"]);

cust.Email = Request.Form["Email"].ToString();

return View(cust);


Code in my second view


var grid = new WebGrid(source: Model.Customer);



The problem is that I get an error saying that you are missing a reference.

When I type Model. in my second view, I get properties defined in the customer model. Instead I need to bind the customer model object to the webgrid.

Could you let me know how to I go about ?
May 19, 2013 at 5:20 PM
Hi rankitmenon9,

Thanks for the question. Unfortunately, this forum isn't really designed for general MVC questions. For a question like this, I would highly recommend using They'll be able to help you pretty quickly over there :)