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

Grouping - Trapping Expand Events to change group text

1 Answer 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 02 Sep 2008, 02:36 PM
Hi,

I am using RadGrid to group data and as suggested by Telerik have been using OnItemDataBound to alter the GridGroupHeaderItem before rendering.

This is all working fine, but i ideally need to be able to change the contents of the group header depending on if its expanded or collapsed.  i.e. collapsed it will display a summary of more information than when expanded.

I have the grid posting back to the server using RadAjaxManager and can trap the OnItemCommand event looking for RadGrid.ExpandCollapseCommandName.

I have two problems here, first off I'd like to get hold of the grouping info of the expanded/collapsed item so it can be stored in the DB so next time the page is loaded it will remember which groups are expanded and which are collapsed.  Is this data available in the event anywhere?

The second problem is I cant get the grid to re-generate the rows, because the data has already been bound it does not go back into my OnItemDataBound event to change the header text.  Is there any way that I can force a re-bind without messing up the expanded/collapsed values (as happens if i call rebind())?

Thanks again

Mike

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 03 Sep 2008, 12:52 PM
Hi Michael,

You can use e.Item.Expanded property in ItemDataBound instead of ItemCommand.

Greetings,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or