Convert to Kendo GridLayout from Kendo Grid

21 Views Asked by At

I need to convert to kendo grid layout from kendo grid.

Heres an example of my kendo grid:

@(
Html.Kendo().Grid<Student>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.StudentID).Width(50);
        columns.Bound(p => p.StudentName).Width(100).Title("Student Name");  
        columns.Bound(p => p.StudentSubject).Width(100);
        columns.Bound(p => p.StudentMarks).Width(100);
        
    })
    .ToolBar(toolbar=>toolbar.Create())
    .Pageable()
    .Sortable()
    .Scrollable()
    .DataSource(dataSource=>dataSource
        .Ajax()
        .PageSize(10)
        .Model(model =>
        {
            model.Id(p => p.StudentID);
            model.Field(p => p.StudentID).Editable(false);
        })
        .Read(read=>read.Action("Read","Students"))
    )
)

Controller:

public JsonResult Read([DataSourceRequest] DataSourceRequest request)
{
    var students = objStudentAccess.GetStudents();
    return Json(students.ToDataSourceResult(request));
}

I need to make this data in a grid view using Kendo GridLayout.

Example for Grid Layout:

@(Html.Kendo().GridLayout()
        .Name("gridlayout")
        .Rows(r=>{
            r.Add();
            r.Add();
            r.Add();
        })
        .Items(i=>{
            i.Add().Row(1).Content("Item 1");
            i.Add().Row(2).Content("Item 2");
            i.Add().Row(2).Content("Item 3");
            i.Add().Row(3).Content("Item 4");
            i.Add().Row(3).Content("Item 5");
            i.Add().Row(3).Content("Item 6");
        })
    )

I also need to understand how I need to get data from controller class.

0

There are 0 best solutions below