[RESOLVED]Problem Implementing jqGrid in MVC

hi 

i was implementing jqgrid using Trirand.Web.Mvc dll file.

i was refer the example from this link http://www.trirand.net/demo/aspnet/mvc/jqgrid/

but i got errors

this is my code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System;
using Trirand.Web.Mvc;
using System.Web.UI.WebControls;

namespace JQGridMVCExamples.Models
{
public class OrdersJqGridModel
{
public JQGrid OrdersGrid { get; set; }

public OrdersJqGridModel()
{
OrdersGrid = new JQGrid
{
Columns = new List() // i got error here
{
new JQGridColumn { DataField = "OrderID",
// always set PrimaryKey for Add,Edit,Delete operations
// if not set, the first column will be assumed as primary key
PrimaryKey = true,
Editable = false,
Width = 50 },
new JQGridColumn { DataField = "CustomerID",
Editable = true,
Width = 100 },
new JQGridColumn { DataField = "OrderDate",
Editable = true,
Width = 100,
DataFormatString = "{0:yyyy/MM/dd}" },
new JQGridColumn { DataField = "Freight",
Editable = true,
Width = 75 },
new JQGridColumn { DataField = "ShipName",
Editable = true
}
},
Width = Unit.Pixel(640),
Height = Unit.Percentage(100)
};

OrdersGrid.ToolBarSettings.ShowRefreshButton = true;
}
}
}

Error 1 Using the generic type ‘System.Collections.Generic.List<T>’ requires 1 type arguments C:Usersananth.gDocumentsVisual Studio 2012ProjectsJQGridMVCExamplesJQGridMVCExamplesModelsOrdersJqGridModel.cs 19 31 JQGridMVCExamples

Error 2 Cannot initialize object of type ‘List’ with a collection initializer C:Usersananth.gDocumentsVisual Studio 2012ProjectsJQGridMVCExamplesJQGridMVCExamplesModelsOrdersJqGridModel.cs 20 34 JQGridMVCExamples

any one give me a solution.

hi friends i got a solution

Columns = new List() // change this line
{

}

Columns = List<JQGridColumn>() // like this
{

}

Hi Ananth,

This link may benefit you:

# List<T> Class

http://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx

Best Regards

Starain Chen

Leave a Reply