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

GroupBy Resets after postback

2 Answers 25 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 04 Jun 2009, 10:54 PM
I have a grid that I add a dynamic groupby expression that defaults as collapsed and it works fine.
However, whenever I postback the grid doesn't recall the states of which were expanded and
resets all to collapsed.  I have seen in the online examples that the grid can retain this information
on postback.  The only difference I can notice on the code is that the example is declared in the
ASPX page and mine in code behind.  The reason that I do not declare mine in the ASPX page is
because my grid can switch datasources and gets grouped by different columns.  Any ideas? 
I have seen on here that some people suggest EnableViewState="True" for the grid, however,
isn't it enabled by default?  Additionally, in case it matters, my grid is located in an UpdatePanel.
Let me know if anyone has any ideas?  Thanks in advance.

Joshua 

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 1
answered on 05 Jun 2009, 03:53 AM
Hi Josh,

I guess the Grid is getting rebind on PostBack and hence the expanded state is getting lost. If so you may refer the following code library submission on Persist Groups Expanded State on Rebind

Shinu

0
Josh
Top achievements
Rank 1
answered on 05 Jun 2009, 07:41 AM
Thanks, worked like a charm.  I don't know how I missed this example when I searched.

Joshua
Tags
Grid
Asked by
Josh
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Josh
Top achievements
Rank 1
Share this question
or