How do you clear selected items when RestoreRowSelection="All"?

1 reply. Last post: February 6, 2015 10:35 AM by leo Chandra
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Bob ElvinMember

I have a grid that has the filter bar, multiple-row selection, and RestoreRowSelection="All" turned on. The grid is not using a row checker column. Basically here's the RootTable settings...

<RootTable Caption="Employees" CellClickAction="RowSelect" DataMember="Table" AutomaticSort="false" AllowMultipleSelection="Yes" DataKeyField="Employee_Number" AllowGrouping="No" HideColumnsWhenGrouped="Yes" GroupMode="Expanded" GroupTotalVisible="false" AllowFilter="Yes">

... and here are the layout settings ...

<LayoutSettings PagingMode="None" AllowAddNew="No" AllowContextMenu="False" AllowDelete="No" AllowEdit="No" AlwaysShowHelpButton="False" EditOnClick="False" AllowFilter="Yes" ApplyFiltersKey="Enter" FilterBarVisible="True" NewRowLostFocusAction="AlwaysUpdate" PromptBeforeDelete="True" ResetNewRowValuesOnError="False" AllowSorting="Yes" cellclickaction="RowSelect" HeaderWrapDefault="true" RowHighlightType="BackgroundOnly" RestoreRowSelection="All" PersistRowChecker="true" StatusBarVisible="false" RowHeightDefault="18px"><SelectedRowStyle BackColor="#FF9900" BackColor2="#FF9900" /><LostFocusRowStyle BackColor="#FF9900" BackColor2="#FF9900" /><CheckedRowStyle BackColor="#FF9900" BackColor2="#FF9900" />   </LayoutSettings>

My issue is with the RestoreRowSelection="All". This grid is listing employees for a given location; when the user changes the location via a web combo the grid is refreshed with a new list of employees for the new location. However, the grid.RootTable.GetCheckedRows() always returns the list of selected employees from the old location no matter what I do. I've tried grid.RootTable.GetSelectedRows().Clear, I've tried forcing the list clear with grid.ClearCachedDataSource and grid.RebindDataSource, and just about everything else I can think of. No matter what I do the grid will restore the previously selected list after the postback to the form. Even if I get the list cleared on a temporary basis it seems to come back when the post back is fully completed.

How do I programatically clear the selected rows when the "RestoreRowSelection="All" option is enabled? In my case the previously selected items no longer exist as valid items to choose from but the internal collection of checked items still lists them. I want that list emptied out but I can't figure out how.


All times are GMT -5. The time now is 7:10 AM.
Previous Next