This is a migrated thread and some comments may be shown as answers.

MVC Grid Ajax databinding issue

2 Answers 71 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 21 May 2013, 02:12 PM
Hi Guys 

Hope someone can help, i am having the most basic of issues with the kendo grid.  I have followed the example for the Kendo MVC grid, i created a UI for MVC Web Application project and to this project added an ado .net Entity Data Model all is well.  

Following the general overview i can get this example working fine, however when i try the ajax databinding i simply cant get my grid to return any data 

i have added the action result method for the read as so 

public ActionResult Meeting_Read([DataSourceRequest]DataSourceRequest request)
        {
            using (var ola = new OnlineActionsEntities())
            {
                IQueryable<Meeting> meetings = ola.Meetings;
                DataSourceResult result = meetings.ToDataSourceResult(request);
                return Json(result);
            }
        }


i have added my grid as so 

@(Html.Kendo().Grid<AdventureWorks.Models.Meeting>()
      .Name("grid")
      .DataSource(dataSource => dataSource // Configure the grid data source
          .Ajax() // Specify that ajax binding is used
          .Read(read => read.Action("Meetings_Read", "Home")) // Set the action method which will return the data in JSON format
       )
      .Columns(columns =>
      {
          // Create a column bound to the ProductID property
          columns.Bound(meeting => meeting.ID);
          // Create a column bound to the ProductName property
          columns.Bound(meeting => meeting.Title);
      })
      .Pageable() // Enable paging
      .Sortable() // Enable sorting
)
when i build and run the grid simply never gets populated ? if i break point the Meeting_Read action result it is simply never called ??  

I must be missing something really obvious but cant see what 

Please help.

Eddie

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Madjarov
Telerik team
answered on 21 May 2013, 02:40 PM
Hello Anthony,


After examining the provided code it seems that the name of the Action is Meeting_Read, but in the Grid's Read Action configuration it is specified as Meetings_Read. This is the reason why it is never called.

I hope this information was helpful for you. Please let me know if I could assist you further?

 

Greetings,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Anthony
Top achievements
Rank 1
answered on 21 May 2013, 02:44 PM
aaaaaaaaaarrrrrrrrrggggghhhhhhh

I said i was missing something really obvious.

Thanks 

Tags
Grid
Asked by
Anthony
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Anthony
Top achievements
Rank 1
Share this question
or