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

Update method not firing.

3 Answers 398 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kelso
Top achievements
Rank 1
Kelso asked on 14 Jul 2014, 05:40 PM
I am not sure what I am missing here, I have a grid that I just want to update, not create or destroy. I thought I had done this correctly, but the save button does not fire my update method on the user controller.  

  <div id="CampaignGrid">
        @(Html.Kendo().Grid<SubCampaign>()
              .Name("grid")
              
              .Columns(columns =>
              {
                  columns.Bound(c => c.CampaignName);
                  columns.Bound(c => c.Status).ClientTemplate("<input type='checkbox' value='#= Status #' " +
                                                                "# if (Status) { #" +
                                                                    "checked='checked'" +
                                                                "# } #" +
                                                            "/>");
              })
              .ToolBar(toolbar => toolbar.Save())
                    .Editable(editable => editable.Mode(GridEditMode.InCell))
                    .DataSource(dataSource => 
                        dataSource.Ajax()
                        .Batch(true)
                        .Model(model =>
                        {
                            model.Id(campaign => campaign.Id);
                            model.Field(campaign => campaign.CampaignName).Editable(false);
                            model.Field(campaign => campaign.Status);
                        })
                        .Read(read => read.Action("SwitchCampaignRead", "User"))
                        .Update(update => update.Action("SwitchCampaigns", "User")))
                        .HtmlAttributes(new { style = "height: 380px;" })
                        .Scrollable()
                        .Sortable()
                        .Pageable(pageable => pageable
                            .Refresh(true)
                            .PageSizes(true)
                            .ButtonCount(5))

              )
    </div>

3 Answers, 1 is accepted

Sort by
0
Kelso
Top achievements
Rank 1
answered on 14 Jul 2014, 06:39 PM
Ok, after looking at this for a while, basically the template does not actually create a checkbox that is wired to the grid, its not until you click on the cell that the checkbox is replaced by one from the kendo scripts that is properly wired to do the call to the update method, so do I
A) use a different checkbox template.
or 
B) Is it possible to make the entire cell clickable to update the checkbox... if that is even possible with the control being replaced by the grid.

any help is appreciated.
0
Vladimir Iliev
Telerik team
answered on 16 Jul 2014, 11:35 AM
Hi Kelso,

I would suggest to check the following example in our CodeLibrary which demonstrates how to achieve the desired behavior:

Regards,
Vladimir Iliev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Kelso
Top achievements
Rank 1
answered on 22 Jul 2014, 06:35 PM
Sadly, it was simply faster for me to create my own grid and do it myself. I find the multiple ways to do the same thing syntactically, confusing, I do something one way, but cannot find the same syntax in any of the demos for what I want to do. I find that really frustrating.
Tags
Grid
Asked by
Kelso
Top achievements
Rank 1
Answers by
Kelso
Top achievements
Rank 1
Vladimir Iliev
Telerik team
Share this question
or