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

Paste data into grid

2 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kendo UI Grid
Top achievements
Rank 1
Kendo UI Grid asked on 14 Oct 2016, 02:47 PM

Hello, I want to paste data into grid, please revise my code. Thanks.

 

@(Html.Kendo().Grid<ConfigurationModel>()
        .Name("grid")
        .Events(e => e.Edit("onGridEdit"))
        .AutoBind(false)
        .Columns(columns =>
        {
            columns.Bound(c => c.A);
            columns.Bound(c => c.B);
            columns.Bound(c => c.C);
            columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
        })
        .ToolBar(toolbar => { toolbar.Create();  toolbar.Excel(); })
        .Editable(editable => editable.Mode(GridEditMode.InLine))
        .HtmlAttributes(new { style = "height: 550px;" })
        .Sortable()
        .Pageable(pageable => pageable
             .Refresh(true)
             .PageSizes(true)
             .ButtonCount(15))
        .Excel(excel => excel
            .FileName("Export.xlsx")
            .Filterable(true)
            .ProxyURL(Url.Action("Excel_Export_Save", "Grid"))
        )
        .DataSource(dataSource => dataSource
            .Ajax()
            .Events(events => events.Error("grid_error"))
            .Model(model =>
            {
                model.Id(p => p.A);
               
            })
            .Create(create => create
                .Action("Create", "Configuration"))
            .Read(read => read
                .Action("Read", "Configuration")
             )
            .Update(update => update
                .Action("Update", "Configuration")
            )
            .Destroy(destroy => destroy
                .Action("Destroy", "Configuration"))
            .PageSize(10)
        )

2 Answers, 1 is accepted

Sort by
0
Kendo UI Grid
Top achievements
Rank 1
answered on 14 Oct 2016, 03:08 PM

The current sample code is using hard code ----- dataSource:[Name: "John Doe", Age: 33]

and $("#grid").kendoGrid()

0
Konstantin Dikov
Telerik team
answered on 18 Oct 2016, 09:22 AM
Hello,

You can attach the event handlers to the Grid element in the same manner with the MVC wrappers when the elements are rendered on the page:
$("#grid").on('focusin', ...
...

As for the dataSource, you will have to modify it according to your exact scenario.



Regards,
Konstantin Dikov
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Kendo UI Grid
Top achievements
Rank 1
Answers by
Kendo UI Grid
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or