title: Infragistics IgniteUI Grid set Datasource(Create Data Access Class or use Entity Framework)?
body: <p>i recently started to use infragistics, i have got the infragistics version 2013.2...
  I am creating a project using mvc 4.0 , and i am trying to use igniteui components...in this case igGrid..
  Is it possible to assign datasource to entity framework ? i saw the youtube video displaying this case, but i am getting errors.
  What is the best way to go, use entity framework model or create my own class?</p>
  
  <p>GridController</p>
  
  <pre><code>namespace MvcApplication5.Controllers
  {
  public class GridController : Controller
  {
      public MvcApplication5Context db = new MvcApplication5Context();
      [GridDataSourceAction]
      public ActionResult GetProducts()
      {
  
  
         return View(MvcApplication5.Models.ProductModel.GetProductList());
      }
      private DataTable GetCustomerDataTable()
      {
  
          SqlConnection conn = (SqlConnection)db.Database.Connection;
          DataTable dt = new DataTable();
          using (SqlConnection con = conn)
          {
              using (SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Product", con))
              {
                  adapter.Fill(dt);
              }
          }
          return dt;
      }
  
  
   }
  }
  </code></pre>
  
  <p>My Products Model:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Data;
  
  namespace MvcApplication5.Models
  {
  public class Product
  {
      public int ID { get; set; }
      public string ProductName { get; set; }
      public Nullable&lt;int&gt; SupplierID { get; set; }
      public Nullable&lt;int&gt; CategoryID { get; set; }
      public string QuantityPerUnit { get; set; }
      public Nullable&lt;decimal&gt; UnitPrice { get; set; }
      public Nullable&lt;short&gt; UnitsInStock { get; set; }
      public Nullable&lt;short&gt; UnitsOnOrder { get; set; }
      public Nullable&lt;short&gt; ReorderLevel { get; set; }
      public string SupplierName { get; set; }
      public string CategoryName { get; set; }
      public int Rating { get; set; }
      public bool Discontinued { get; set; }
      public string CategoryImageUrl { get; set; }
  }
  
  public class ProductModel
  {
      public static IQueryable&lt;Product&gt; GetProductList()
      {
          MvcApplication5Context db = new MvcApplication5Context();
          var Products = from c in db.Products
                         orderby c.ID
                         select c;
          return Products.AsQueryable&lt;Product&gt;();
      }
  }
  }
  </code></pre>
  
  <p>And my view;</p>
  
  <pre><code>@using Infragistics.Web.Mvc
  @model IQueryable&lt;MvcApplication5.Models.ProductModel&gt;
  @{
  ViewBag.Title = "GetProducts";
   }
  
  &lt;h2&gt;GetProducts&lt;/h2&gt;
   @(Html.Infragistics().Grid&lt;MvcApplication5.Models.ProductModel&gt;()
      .ID("grid1")
      .Height("400px")
      .Width("100%")
      .AutoGenerateColumns(true)
      .DefaultColumnWidth("150px")
  
      .DataSource(Url.Action("GetProducts"))
      .DataBind()
      .Render()
  )
  </code></pre>
  
  <p>I have made some test, and i have manage to create a datatable and bind it to the iqGrid..
  The video is low resolution and i cant see the last part...</p>
  
  <p>thanks in advance...</p>