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

[Solved] Problem with grouping in RadGrid

1 Answer 160 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sathya
Top achievements
Rank 1
Sathya asked on 28 Apr 2008, 05:34 AM
Grouping works fine in the normal condition. (i.e) When i drag a column and drop it in the group panel the columns are grouped perfectly.

But the problem is, when i refresh the page in the above said conditon the grouped columns comes to the normal state. (ie) Groping is undone.

When i refresh the page, the grouped elements in the page come back to the ungrouped state. What should i do so that the Grouped elemets remains in the same state, even if i refresh the page.


Here is the code snippet which i have used:

 <rad:RadGrid ID="rGrid" Width="100%" RadControlsDir="~/_controltemplates/OrganiceTeam/RadControls"
                AutoGenerateColumns="false" Skin="none" GroupingEnabled="true" ShowGroupPanel="true"
                EnableAJAX="true" AllowPaging="true" PageSize="10" EnableOutsideScripts="true"
                runat="server" MasterTableView-TableLayout="Auto" AllowFilteringByColumn="True">
                <MasterTableView CommandItemDisplay="Bottom" CellPadding="2" CellSpacing="2" GroupLoadMode="Client">
                 <CommandItemStyle CssClass="ms-menutoolbar" />
                    <ExpandCollapseColumn Resizable="False" Visible="False">
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <RowIndicatorColumn Visible="False">
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <NoRecordsTemplate>
                        <div class="ms-toolbar">
                            <asp:Label runat="server" ID="lblNoRecords">No site creation request exists.</asp:Label>
                            <br />
                        </div>
                    </NoRecordsTemplate>
                </MasterTableView>
             
                <ClientSettings ReorderColumnsOnClient="True" AllowColumnsReorder="True" AllowDragToGroup="True"
                    AllowGroupExpandCollapse="True" AllowExpandCollapse="True">
                    <Resizing AllowColumnResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" />
                </ClientSettings>
                <GroupPanel Font-Names="Tahoma">
                    <PanelStyle Font-Names="Tahoma" CssClass="ms-toolbar" Height="25" Font-Bold="true" Width="100%"  />
                </GroupPanel>
            </rad:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Todd Anglin
Top achievements
Rank 2
answered on 28 Apr 2008, 03:19 PM
Sathya-

When you say "refresh page," do you mean actually refreshing the page (as in, via the browsers refresh button) or a "refresh" caused by a PostBack? If it's the later, you shouldn't have problems persisting the grouped state. If it's the prior, you'll have to implement some custom support for remembering your users grouping settings.

Why? Well, a refresh is just like a first request to a page. There is no state associated with the request, so the page is initialized just like it is first time you visit. If you want to persist Grid settings across page refreshes (or even site visits), you'll simply need to store the Grid's sort expression in a persistent medium (like a cookie or Profile). During the page's loading, you'll query this persistent medium, look for a grouping expression, and if one is found apply it to the Grid.

Hopefully that path makes sense. Let me know if you have any questions and I'll be happy to help.

-Todd
Tags
General Discussions
Asked by
Sathya
Top achievements
Rank 1
Answers by
Todd Anglin
Top achievements
Rank 2
Share this question
or