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

[Solved] How Do I Create custom bindings on grid control

0 Answers 84 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
william
Top achievements
Rank 1
william asked on 06 Jul 2011, 02:34 PM
Hi All,

I have a couple of issues trying to use the Grid Contriol.

Basically against each line I require an Edit and Delete button. When the user presses the Edit button I do not want to perform any of the functions given in the telerik example. I instead want to force control back to the controller and then open a new view. Also it places the buttons in the first line underneath each other and all otherlines with buttons side by side ??:
@(Html.Telerik().Grid(Model.Sections)
    .Name("policyZoneGrid")
    .Sortable()
    .DataKeys(keys => keys.Add(r => r.SectionID))
    .DataBinding(dataBinding => dataBinding.Ajax()
        .Update("SaveAjaxEditing","PolicyZoneController")
        .Delete("DeleteAjaxEditing", "PolicyZoneController")
    )
    .Columns(columns =>
        {
            columns.Command(commands =>
                { commands.Edit();
                  commands.Delete();  
                }).Width(50).Title("Commands");
            columns.Bound(r => r.Name).Width(10);
            columns.Bound(r => r.UIDisplayName).Width(10);
        })
      
    .Groupable(grouping => grouping.Groups(groups =>
        {
            groups.Add(r => r.UIDisplayName);
        }))
    .Sortable(sorting => sorting.OrderBy(sortOrder => sortOrder.Add(o => o.UIOrder).Descending()))
    .Pageable()
      
)

In my controller I just have stubs at the moment to prove that the post happens on each of the button clicks which it doesn't.

[AcceptVerbs(HttpVerbs.Post)]
    [Telerik.Web.Mvc.GridAction]
    public ActionResult SaveAjaxEditing()
    {
        return View();
    }
    [AcceptVerbs(HttpVerbs.Post)]
    [Telerik.Web.Mvc.GridAction]
    public ActionResult DeleteAjaxEditing()
    {
        return View();
    }
Tags
General Discussions
Asked by
william
Top achievements
Rank 1
Share this question
or