Unable to get data into kendo grid

2 posts, 0 answers
  1. Scott
    Scott avatar
    1 posts
    Member since:
    Oct 2015

    Posted 24 Nov 2015 Link to this post

     Hello, I am unable to get data into my kendo grid. I have looked at many other threads but nothing has helped so far. I want to get the data from my controller / model but I am not sure if i am trying to do it correctly


    @model MyProject.Models.POApprovalViewModel 
        Layout = "~/Views/Shared/_Layout.cshtml";
        ViewBag.Title = "PO Approval";
    <div class="container">
        <h4>PO Approval</h4>     
                  .Columns(columns =>
                      columns.Bound(model => model.PoId);
                      columns.Bound(model => model.PoStatus);
                  .DataSource(dataSource => dataSource
                      .Model(model => model.Id("PoId"))
                      .Read(read => read.Action("POApproval_Read", "POApproval"))



    public class POApprovalController : Controller
        string UserId;
        POApprovalViewModel po;
        // GET: POApproval
        public ActionResult Index()
            po = new POApprovalViewModel();
            return View(po);
        public ActionResult POApproval_Read()
            dbPOApproval db = new dbPOApproval();
            return Json(db.GetAssignedApprovals());



        public class POApprovalViewModel
           public List<OLAssignedApprovals> AssignedApprovals
                   if (_AssignedApprovals == null)
                       _AssignedApprovals = new List<OLAssignedApprovals>();
                   return _AssignedApprovals;
           private List<OLAssignedApprovals> _AssignedApprovals;
       public class OLAssignedApprovals
           public int PoId { get; set; }
           public string PoStatus { get; set; }
       public class dbPOApproval
           MyDataSourceOjbect objPOApproval = new MyDataSourceOjbect();
           public List<Models.OLAssignedApprovals> GetAssignedApprovals()       
               List<Models.OLAssignedApprovals> lPoApproval = new List<Models.OLAssignedApprovals>();
               Models.OLAssignedApprovals li = new Models.OLAssignedApprovals();
               DataSet ds = objPOApproval.GetPOApprovals();
               foreach (DataRow dr in ds.Tables[0].Rows)
                   li = new Models.OLAssignedApprovals();
                   li.PoId = Convert.ToInt32(dr["POID"]);
                   li.PoStatus = dr["POStatus"].ToString();
               return lPoApproval;

  2. Dimiter Madjarov
    Dimiter Madjarov avatar
    2277 posts

    Posted 25 Nov 2015 Link to this post

    Hello Scott,

    Could you specify how would you like to populate the Grid data - locally by passing a Model collection or remotely by using a read action? The current one is a mix of both, which is used in rare cases.

    Dimiter Madjarov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top