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

Kendo grid with dynamic behaviour

1 Answer 11 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Palanisamy
Top achievements
Rank 1
Palanisamy asked on 24 Sep 2015, 02:49 PM

Hi I need to populate the columns and page size from database. Not from model and hardcoding. I mean everything will be in dynamic. Kindly help me and provide the samples for this. My Existing code below.

  @(Html.Kendo().Grid<kendo_grid_with_web_api_and_ondemand.Models.MsgDetails>()
    .Name("gridnew")
    .Columns(columns =>
    {
        columns.Bound(o => o.MsgNum).Width(110);
        columns.Bound(o => o.MsgDesc).Width(130);
    })
    .Sortable()
    .Scrollable(scrollable => scrollable.Virtual(true))
    .Pageable()
    .HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(100)
        .Read(read => read.Action("MsgDetails_Read", "Home"))
     )
    )

 

Columns,Pagesize,Scrollable every property will be in DB. So I need to load populate from db with mvc kendo grid. Kindly help me.

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 28 Sep 2015, 07:38 AM

Hello Palanisamy,

The options should be set when the Grid is initialized, if you want to change them on the fly from your dataBase you can use the setOptions method once you have the options available and set them on the Grid. Here is the documentation about it:

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-setOptions

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Palanisamy
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or