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

Preserve expand collapse state after rebinding data

5 Answers 416 Views
Grid
This is a migrated thread and some comments may be shown as answers.
arno koolen
Top achievements
Rank 1
arno koolen asked on 06 Jul 2008, 10:02 AM

I have a RadGrid with 3 levels of hierarchy declared as below (some markup left out for readability)

<telerik:RadGrid    ID="RadGrid1"   
                    runat="server"   
                    AllowSorting="True"   
                    Skin="Office2007"   
                    ShowStatusBar="True"   
                    GridLines="None"   
                    DataSourceID="SQLDataSource1"   
                    AutoGenerateColumns="False" 
                    EnableViewState="true">  
 
    <MasterTableView    HierarchyLoadMode="ServerBind"   
                        EnableNoRecordsTemplate="true"   
                        DataKeyNames="PartGroupID,PartGroupParentID"   
                        Width="100%"   
                        ShowHeader="true"   
                        AllowPaging="false">  
                            <SelfHierarchySettings  ParentKeyName="PartGroupParentID"   
                                                    KeyName="PartGroupID"   
                                                    MaximumDepth="10" /> 

Users will expand/collapse and collapse the structure, but will also modify the data in the grid. When the data is modified, the RadGrid needs to rebind.

RadGrid1.Rebind(); 

Unfortunately when this happens the grid either collapses fully or expands fully depending on whether the

<MasterTableView HierarchyDefaultExpanded="true" 

is set or not.

What I want is for the grid to maintain its expanded/collapsed state after rebinding, otherwise the user has to expand collapse the grid again to navigate back to node they were editing before the ReBind() was called.

Is there any way to preserve the state, short of rolling my own code?


Thanks,

Malcolm

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 Jul 2008, 04:39 AM
Hi Malcolm,

Here is a code library which explains how to retain the expanded state of the Grid on rebind. Go through it and see whether it helps.
Retain expanded/selected state in hierarchy on rebind

Thanks
Shinu.
0
Alex
Top achievements
Rank 2
answered on 30 Apr 2014, 09:12 PM
shinu, the link you provided is dead.
0
Shinu
Top achievements
Rank 2
answered on 02 May 2014, 03:25 AM
Hi Alex,

You can take a look at this code Library on Retain expanded/selected state in hierarchy on rebind.

Thanks,
Shinu
0
Eyup
Telerik team
answered on 05 May 2014, 07:55 AM
Hi Alex,

You can also use the following recently introduced property:
<MasterTableView ... RetainExpandStateOnRebind="true">

Hope this helps.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mousumi
Top achievements
Rank 1
answered on 20 Nov 2015, 07:15 AM
Great!!Working fine by just setting a single property
Tags
Grid
Asked by
arno koolen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Alex
Top achievements
Rank 2
Eyup
Telerik team
Mousumi
Top achievements
Rank 1
Share this question
or