Kendo Grid (delete, edit buttons)

KamalF

I have a kendo grid that shows fetch data from sql using UA function, the grid is dynamic and i am able to view the details i want. I want to be able to delete, edit the given data. I though one idea can be taking the attributes given in this table and use them in other functionto edit or delete in the database. The problem now is that i can not edit or fetch these details from the grid table by any means, i tried adding .Destroy to the grid or any command function but not working.

Here is the code for the grid:

@(Html.Kendo().Grid<dynamic>()
.Name("BrowseGrid")
.Columns(columns =>
{
    foreach (System.Data.DataColumn c in Model.GridNodes.Columns)
    {
        columns.Bound(c.ColumnName).EditorTemplateName("String");
    }
})
.Scrollable()
.DataSource(dataSource => dataSource
    .Ajax()
    .Events(events => events.Error("error_handler"))
    .Model(model =>
    {
        foreach (System.Data.DataColumn column in Model.GridNodes.Columns)
        {
            model.Field(column.ColumnName, column.DataType);
            model.Id("Id");
        }
    })
    .Read(read =>

        read.Action("BrowseGrid", "Configuration")
    )

)
        .Pageable(pageable => pageable
        .Refresh(true)
        .PageSizes(new int[] { 10})
        .ButtonCount(10)
    ) )

Any suggestions??

KamalF

change to:

.Destroy(update => update.Action("Process_Destroy", "controller name"))
and in controller,

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Process_Destroy([DataSourceRequest] DataSourceRequest  request, ProductViewModel product)
{
if (product != null)
{
    //write your code for delete action;
}

return Json(ModelState.ToDataSourceResult());
}

This will work.

This is perfectly working but not for a dynamic grid, as a dynamic grid will cause some problems within the Kendo UI.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related