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

Grid data source paramter

2 Answers 17 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 13 Jul 2015, 04:51 PM

Hi, I have a grid data source paramter thats coming from the model, when the partialview containting the grid is first rendered the value is passed back correctly but then after that its not being sent back, ive even put a breakpoint on the grid to see what the accountid value was and it was correct, but on Read its being sent as 0 which is default value

 

  @(Html.Kendo().Grid<LiteraSite.Models.AccountCamps>()
                .Name("grdAccountCamps")
                .Columns(col =>
                  {
                      col.Bound(p => p.Selected).HtmlAttributes(new { @style = "padding-left: 5px;" }).ClientTemplate("<input # if(Selected) {# checked='checked' # } #  value='selected' type='checkbox' />");
                      col.Bound(p => p.CampCode).HtmlAttributes(new { @style = "padding-left: 8px;" });
                      col.Bound(p => p.CampName).Title("Account Users").HtmlAttributes(new { @style = "padding-left: 5px;" });
                  })
                                     .Navigatable()
                                                    .Scrollable(src => src.Height(260))
        .DataSource(dataSource => dataSource
            .Ajax()

                                                      .Model(model => model.Id(p => p.CampID))
                                       .Read(read => read.Action("GetCampsWithSelection", "Administration", new { @clientAccountID = (int) Model.FoundAccount.AccountID  })
                                   )
))

 

 

 

2 Answers, 1 is accepted

Sort by
0
Jim
Top achievements
Rank 1
answered on 13 Jul 2015, 05:03 PM

I have to add that because Kendo Grid doesnt seem to fire the read method when its in a partial view i have to use the following javascript function:

    function ReadAccountCamps() {   
        $('#grdAccountCamps').data('kendoGrid').dataSource.read();
     }

 

0
Boyan Dimitrov
Telerik team
answered on 15 Jul 2015, 03:03 PM

Hello Jim,

 

I am not completely sure that I understand the problem you are facing. 

 

I noticed that there is no filtering,grouping, sorting or etc operation enabled that will initiate a request to the read action method. 

 

I assume that you call the read method of the data source explicitly. Does it mean that only the first time when you call the read method the model value is sent correctly and if you call the read method once again it will send 0? 

 

An isolated runnable example will be very helpful in order to investigate the described behavior. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Jim
Top achievements
Rank 1
Answers by
Jim
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or