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

[Solved] grid selection reg:

1 Answer 20 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
మాధవ్
Top achievements
Rank 1
మాధవ్ asked on 20 Mar 2013, 06:44 PM
When i select a row on a grid and refresh the grid or reload with new data i should get back the row i selected.

The code is as written below:


@{Html.Telerik().Grid(Model)
    .Name("CTStatusGrid")
    .DataKeys(keys => keys.Add("AccountCollectionStatusID"))
    .DataBinding(dataBinding => dataBinding.Ajax().Select("_GetCTStatusCodes", "AccountCollectionStatus"))
    .ClientEvents(events => events
                         .OnRowDataBound("Grid_onRowDataBound")
                         .OnDataBound("CTStatusGridBound")
                         .OnRowSelect("CTStatusGridRowSelected")
                         .OnError("CTStatusGridErrored")
                         )                
    .Columns(columns =>
    {
        columns.Bound(o => o.Code).Title("Code").Width(100);
        columns.Bound(o => o.Name).Title("Name").Width(150);
        columns.Bound(o => o.Description).Title("Description").Width(150);
        columns.Bound(o => o.PASAccountCollectionStatus).Title("PAS Coll Status").Width(150);
        columns.Bound(o => o.IsActive).ReadOnly().Title("Active").ClientTemplate("<input type='checkbox' name='ckActive' <#= IsActive? checked='checked' : '' #> onclick='return false'  />").Width(60);
        columns.Bound(o => o.IsAccount).ReadOnly().Title("Account Status").ClientTemplate("<input type='checkbox' name='ckAccount'  <#= IsAccount? checked='checked' : '' #> onclick='return false' />").Width(120);
        columns.Bound(o => o.IsVisit).ReadOnly().Title("Visit Status").ClientTemplate("<input type='checkbox' name='ckVisit' <#= IsVisit? checked='checked' : '' #> onclick='return false' />");
    })
    .Selectable()
    .Scrollable(c => c.Height("450px"))
    //.Pageable(paging => paging.PageSize(20).Style(GridPagerStyles.NextPreviousAndNumeric).Position(GridPagerPosition.Bottom))
    .Sortable()
    .Filterable()
    .Groupable()
    .Resizable(resizing => resizing.Columns(true))
    .Render();


Any Suggestions, how to do it??????

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 25 Mar 2013, 02:40 PM
Hello Sethu,

The Grid selection is lost when the page is refreshed (reloaded) or when the Grid is rebound (due to sort/page/group etc.).
To preserve the selection you can use the approach covered in this code library article:

http://www.kendoui.com/code-library/web/grid/preserve-grid-state-in-a-cookie.aspx

Kind Regards,
Petur Subev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
Grid
Asked by
మాధవ్
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or