I'm using the webdatagrid from Infragistics45.Web.v16.1, Version=16.1.20161.2117. The grid has filtering enabled.
The problem with this is when the user select Filter. The WebDataGrid.Behaviors.Selection.SelectedRows.Count has the right count of selected rows, but on WebDataGrid screen not selected.
Hello Hung Nguyen,
Thank you for posting your question to our forum.
I'm not sure whether or not I exactly understand your question, but as far as I see, the issue "WebDataGrid.Behaviors.Selection.SelectedRows.Count has the right count of selected rows, but on WebDataGrid screen not selected" is not reproduced on my side.
I attached a sample application in which there is a WebDataGrid with Selection, Filtering, Activation and RowSelectors enabled. Could you give it a try to see whether or not your issue occurs there?
Please kindly understand that the sample uses v19.2 because v16.1's support period has already been expired.
4885.F121567-SapmleApp1.zip
Hi Noriko I,
1. Open My Web2. Select the filter icon on the Last Name column. Unselect "All" and thenselect 4 other itemsResult => grid is now filtered and shows 4 items but none are selectedExpected Result => After the grid is filtered, I wants the last row inthe grid to be selected.
This is the code I handle for the task:
protected void WebDataGrid1_DataFiltered(object sender, Infragistics.Web.UI.GridControls.FilteredEventArgs e) {
WebDataGrid1.Behaviors.Selection.SelectedRows.Clear(); if (WebDataGrid1.Rows != null && WebDataGrid1.Rows.Count > 0) {WebDataGrid1.Behaviors.Selection.SelectedRows.Add(WebDataGrid1.Rows[WebDataGrid1.Rows.Count - 1]); }
But last row in the grid is not selected.
How to make last row selected?
Hello Hung Nguyen
Thank you for the clarification.
You might want to set a kind of flag in DataFiltered event and to execute the selection in a later phase, for example, in the PreRender event because of the timing.
private bool _isDataFiltered = false; protected void WebDataGrid1_DataFiltered(object sender, Infragistics.Web.UI.GridControls.FilteredEventArgs e) { _isDataFiltered = true; } protected void WebDataGrid1_PreRender(object sender, EventArgs e) { if (_isDataFiltered) { WebDataGrid1.Behaviors.Selection.SelectedRows.Clear(); if (WebDataGrid1.Rows != null && WebDataGrid1.Rows.Count > 0) { WebDataGrid1.Behaviors.Selection.SelectedRows.Add(WebDataGrid1.Rows[WebDataGrid1.Rows.Count - 1]); } } }
Could you try this?