No data in grid when calling MVC controller via dataSource

3 posts, 0 answers
  1. Ross
    Ross avatar
    11 posts
    Member since:
    Aug 2012

    Posted 04 Sep 2012 Link to this post

    I've attached a test project and the grid/dataSource is hitting my MVC controller but not data is returned or showing in the grid.  Can someone please help me understand the problem?  See attached.
  2. Ross
    Ross avatar
    11 posts
    Member since:
    Aug 2012

    Posted 05 Sep 2012 Link to this post

    I guess my controller Read() method was a little to fancy.  I just changed how it returned the data (simplified it) and it worked great.

    [HttpPost]
            public ActionResult Read()
            {
                return Json(_list);
                //return Json(new
                //{
                //    data = _list,
                //    success = true
                //}, JsonRequestBehavior.AllowGet);            
            }
  3. Amol G
    Amol G avatar
    5 posts
    Member since:
    Mar 2011

    Posted 20 Sep 2012 Link to this post

    Hi,

    I just change in controller Post Method below is the change.
     [HttpPost]
            public JsonResult Read()
            {
                return new JsonResult { Data = _list };
              }

    it working at my end

    Thanks,
    Amol Gunjal
Back to Top