We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Request for code for Grid

Thread ID:





128134 Jan 4,2017 12:28 PM UTC Jan 5,2017 12:51 PM UTC ASP.NET MVC 1
Tags: Grid
Asked On January 4, 2017 12:28 PM UTC

I am  binding data coming as list not showing in grid ?
How can I bind the data in form of list coming from controller in grid ?

I need code for this in view and controller.

Ramdhas  Ueikattan [Syncfusion]
Replied On January 5, 2017 12:51 PM UTC

Hi Ashwan, 

Thanks for contacting Syncfusion Supports. 

We have created a sample based on your requirement . please find the code example. 

                .Columns(col => 
                    col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(90).Add(); 
                    col.Field("CustomerID").HeaderText("Customer ID").Width(100).Add(); 
  public ActionResult Index(){ 
            var Data = GetData(); 
            ViewBag.dataSource = Data; 
            return View(); 
        public static List<Details> GetData() 
             List<Details> jsons = new List<Details>(); 
             int code = 1000; 
             for (int i = 1; i <= code; i++ ){ 
              jsons.Add(new Details(){ OrderID = code +i, EmployeeID =i, CustomerID= "ALAKI", Freight = code * 0.23}); 
                 jsons.Add(new Details(){ OrderID = code +i+1, EmployeeID =i, CustomerID= "VINET", Freight = code * 0.56}); 
                 jsons.Add(new Details() { OrderID = code +i+2 , EmployeeID = i, CustomerID = "TOMSP", Freight = code * 0.11 }); 
                 jsons.Add(new Details() { OrderID = code + i+3, EmployeeID = i, CustomerID = "VICTE", Freight = code * 0.44 }); 
                 i = i+4 ; 
             return jsons; 
    public class Details { 
        public int OrderID { get; set; } 
        public int EmployeeID { get; set; } 
        public string CustomerID { get; set; } 
        public double Freight { get; set; } 

For your convenience please find the sample . 

Thanks & Regards, 
Ramdhas U 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon