I am trying to retain expanded and selected columns in my radgrid with a detailview after row drop from another grid.
I am following the guides here and have set EnableAJAX="False" on my RadAjaxManager. My problem is that the ItemCommand event is not fired unless it performs a sort.
here is the grid I am trying to retain select and Expand Collapse on
Code Behind (although it doesn't reach this):
I would appreciate any help as I am lost.
I am following the guides here and have set EnableAJAX="False" on my RadAjaxManager. My problem is that the ItemCommand event is not fired unless it performs a sort.
here is the grid I am trying to retain select and Expand Collapse on
| <telerik:RadGrid ID="rgGroups" runat="server" OnItemCommand="rgGroups_ItemCommand" |
| OnDataBound="rgGroups_DataBound" AllowFilteringByColumn="True" AllowPaging="True" |
| AllowSorting="True" AllowMultiRowSelection="True" AutoGenerateColumns="False" |
| DataSourceID="obsUserGroups" GridLines="None" ShowGroupPanel="True" Skin="Hay" |
| PageSize="30"> |
| <HeaderContextMenu> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </HeaderContextMenu> |
| <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="true" AllowRowsDragDrop="true" |
| AllowExpandCollapse="True"> |
| <Selecting AllowRowSelect="true" EnableDragToSelectRows="true" /> |
| </ClientSettings> |
| <MasterTableView AllowMultiColumnSorting="True" |
| DataKeyNames="GroupID" |
| DataSourceID="obsUserGroups" |
| HierarchyLoadMode="Client" |
| NoDetailRecordsText="No groups defined." |
| ShowHeadersWhenNoRecords="false" |
| NoMasterRecordsText="No groups found."> |
| <DetailTables> |
| <telerik:GridTableView runat="server" AllowPaging="False" |
| AutoGenerateColumns="False" |
| DataKeyNames="UserID,GroupID" DataSourceID="obsGetGroupMembers" |
| NoMasterRecordsText="No users found." |
| NoDetailRecordsText="No users in group." |
| ShowHeadersWhenNoRecords="False"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| <ParentTableRelation> |
| <telerik:GridRelationFields DetailKeyField="GroupID" MasterKeyField="GroupID" /> |
| </ParentTableRelation> |
| <Columns> |
| <telerik:GridBoundColumn SortExpression="FName" HeaderText="FName" UniqueName="FName" |
| DataField="FName" /> |
| <telerik:GridBoundColumn SortExpression="LName" HeaderText="LName" UniqueName="LName" |
| DataField="LName" /> |
| <telerik:GridBoundColumn SortExpression="UserEmail" HeaderText="UserEmail" UniqueName="UserEmail" |
| DataField="UserEmail" /> |
| </Columns> |
| </telerik:GridTableView></DetailTables> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn Visible="True"> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn DataField="GroupName" HeaderText="Group" SortExpression="GroupName" |
| UniqueName="GroupName"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView><FilterMenu> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </FilterMenu> |
| </telerik:RadGrid> |
Code Behind (although it doesn't reach this):
| Protected Sub rgGroups_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgGroups.ItemCommand |
| 'save the expanded/selected state in the session |
| If e.CommandName = RadGrid.ExpandCollapseCommandName Then |
| 'Is the item about to be expanded or collapsed |
| If Not e.Item.Expanded Then |
| 'Save its unique index among all the items in the hierarchy |
| Me.ExpandedStates(e.Item.ItemIndexHierarchical) = True |
| Else |
| 'collapsed |
| Me.ExpandedStates.Remove(e.Item.ItemIndexHierarchical) |
| Me.ClearExpandedChildren(e.Item.ItemIndexHierarchical) |
| End If |
| 'Is the item about to be selected |
| ElseIf e.CommandName = RadGrid.SelectCommandName Then |
| 'Save its unique index among all the items in the hierarchy |
| Me.SelectedStates(e.Item.ItemIndexHierarchical) = True |
| 'Is the item about to be deselected |
| ElseIf e.CommandName = RadGrid.DeselectCommandName Then |
| Me.SelectedStates.Remove(e.Item.ItemIndexHierarchical) |
| End If |
| End Sub |
I would appreciate any help as I am lost.