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

[Solved] Server Binding Actions Not Firing

1 Answer 17 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Missing User
Missing User asked on 29 Nov 2011, 05:58 PM
Hello all,
I'm very new to Telerik controls, so I'm probably missing something very obvious.

I have followed the instructions to get a grid editable, but using server binding, the actions defined for Edit and Delete do not fire.  The controller action that renders the grid is the only thing that fires.

I have put breakpoints in the grid methods but there is no indication they fire and data is not updated.

Here is my View:

<% Html.Telerik().Grid(Model.MyList)
.Name("Grid1")
.DataKeys(keys => keys.Add(c => c.myId))                          
.DataBinding(dataBinding => dataBinding
  .Server()
  .Enabled(true)
  .Delete("Delete", "Home")
  .Update("Update", "Home"))                          
  .Columns(columns =>
   {
     columns.Bound(o => o.myId).Width(1).ReadOnly();
     columns.Bound(o => o.PartnerSegmentName).Width(5);
     columns.Command(commands =>
        {
           commands.Edit().ButtonType(GridButtonType.Image);
           commands.Delete().ButtonType(GridButtonType.Image);
         }).Title("Commands");                                                                         
      })
    .Sortable()
    .Editable(e => e.Enabled(true))
    .Render();
%>

Controller Actions:

[HttpPost]
public ActionResult Delete(string id)
{
    throw new NotImplementedException();
}
 
[HttpPost]
public ActionResult Update(string segid)
{
    // Get data to edit into editedmap
    if (TryUpdateModel(editedmap))
    {
        // update my stuff
    }
    return RedirectToAction("Home", this.GridRouteValues());
 
}

What am I missing from making these actions fire?

Thanks,
R

1 Answer, 1 is accepted

Sort by
0
Missing User
answered on 29 Nov 2011, 08:17 PM
Yep, it was something basic.

I had some binding happening using the Html.BeginForm() helper and I realized I have to have the grid outside of it.

So I moved my grid after the closing } and it works just fine.

Oy.
<% using (Html.BeginForm())
{%>
<% } %>

Thanks,
R
Tags
Grid
Asked by
Missing User
Answers by
Missing User
Share this question
or