hi , i want to select each row in my wingrid.
i try it with
For Each selectedRow As UltraGridRow In Grid_Anlagen1.Rows selectedRow.Selected = True Next
but it would be always select one row (of 200)
The SelectTypeRow is most likely set to Single. Change it to Extended:
grd.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Extended
You can do above in the designer, e.g. via Feature Picker -> Selection -> Row Selection
In code, good place for it is in InitializeLayout:e.Layout.Override.SelectTypeRow = UltraWinGrid.SelectType.Extended
Your row selection code will then work, but you can also accomplish the same thing with one line of code, like this:
grd.Selected.Rows.AddRange(grd.Rows.All)
Trausti
hi trausti, thanks for your reply. but that i have already done
Me.Grid_Anlagen1.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Extended
Me.Grid_Anlagen1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelecti go through a loop to each row and in dependence on certain criteriai want select the row. i have aprox. 200 rows, i must select (for example ) 40 rows, but i have always select one
Hi,
I just wanted to know if you were able to solve your issue based on my suggestions or you still need help? Just let me know.
Thank you.
Hello,
Please verify that SelectedTypeRow is set to Extended (also you should be sure that you didn’t change this somewhere in your code, also if you load layout (or preset) value of SelectedTypeRow could be overridden from the loaded layout).
And if you want to select even rows for example you could use code like:
UltraGrid1.Rows.Where(Function(row) (DirectCast(row.Cells("Col2").Value, Integer) Mod 2 = 0)).ToList().ForEach(AddressOf SelectRow)
Shared Sub SelectRow(ByVal row As UltraGridRow)
row.Selected = True
End Sub
Also I have implement this suggestion in a small sample.
Please let me know if you have any further questions.