title: Can I bind jqGrid source from DataTable directly as done in asp DataGrid control
body: <p>In my MVC application I am using jqGrid for displaying records throughout the application. To load the grid I am iterating over the Dataset object retrieved from stored procedure to build List of structured object. See the code below</p>
  
  <pre><code>List&lt;CustomerOrders&gt; ResultRows = new List&lt;CustomerOrders&gt;();
          JQGridResult Result = new JQGridResult()
          {
              page = 1,
              records = 0,
              orders = new List&lt;CustomerOrders&gt;(),
              total = 1
          };
          DataSet SearchResult = DB.ExecuteDataset("ConnectionString", "pc_ADMDbdPOXOrderStatsDetails",
                                  new SqlParameter("@AggregateFlag", 1),
                                  new SqlParameter("@CustomerID", SessionManager.GetSession().CustomerID),
                                  new SqlParameter("@QualifierType", QualifierType),
                                  new SqlParameter("@FromDate", FromDate),
                                  new SqlParameter("@ToDate", ToDate),
                                  new SqlParameter("@RoleList", null),// remove SqlParameter; when SP is modified to remove this param.
                                  new SqlParameter("@BranchList", BranchList == "" ? null : BranchList),
                                  new SqlParameter("@Display", null));
          //Export to Excel
          Common.SetSession(SearchResult, null, "POXOrderStatistics");
  
          DataRowCollection DataRows = SearchResult.Tables[0].Rows;
          foreach (DataRow item in DataRows)
          {
              ResultRows.Add(new CustomerOrders()
              {
                  CustomerID = Convert.ToInt32(item["CustomerID"]),
                  CompanyName = Convert.ToString(item["CompanyName"]),
                  ReadingCount = Convert.ToInt32(item["ReadingCount"]),
                  DateRange = string.Format("From: {0} To: {1}", FromDate, ToDate)
              });
          }
          Result.orders = ResultRows;
          Result.records = ResultRows.Count;
          return Json(Result, JsonRequestBehavior.AllowGet);
  </code></pre>
  
  <p>Now what I want is do eliminate this iteration over the dataset &amp; need to find out way by which I can directly return my Dataset/ DataTable object as records source for jqGrid. Somwhat similar to how we bind DataSet object to asp grid control.
  If anybody have done such kind implementation please help me in this code elimination</p>