// This is the default action for the View. Use it to setup your grid Model.
        public ActionResult PerformanceLinqSearch()
        {
            var context    = new Order11();
            var ordersGrid = context.OrdersGrid;

            // This action will return the data needed by the grid
            ordersGrid.DataUrl = Url.Action("PerformanceLinqSearch_DataRequested");

            // customize the default Orders grid model with custom settings
            // NOTE: you need to call this method in the action that fetches the data as well,
            // so that the models match
            SetUpGrid(ordersGrid);

            // Pass the custmomized grid model to the View
            return(View(context));
        }
        // This method is called when the grid requests data
        public JsonResult PerformanceLinqSearch_DataRequested()
        {
            // Get both the grid Model and the data Model
            // The data model in our case is an autogenerated linq2sql database based on Northwind.
            var context        = new Order11();
            var northWindModel = new OrderContext();

            SetUpGrid(context.OrdersGrid);

            JQGridState gridState = context.OrdersGrid.GetState();

            Session["gridState"] = gridState;
            // return the result of the DataBind method, passing the datasource as a parameter
            // jqGrid for ASP.NET MVC automatically takes care of paging, sorting, filtering/searching, etc

            return(context.OrdersGrid.DataBind(northWindModel.Orders));
        }