Hello,
I just wanted to share this in case anyone else had the same issue.
Scenario
+ RadGridView bound to datasource.
+ Multiselect enabled
Pre Q3 2010 you were able to loop over the rows and set each SelectedRow IsVisible property to False as below
Post Q3, you can only do this if you have only 1 row selected. With multiple rows selected the RadGridView throws an InvalidOperationException (collection was modified) exception.
In order to get over this, one needs to use the BeginUpdate / EndUpdate methods of RadGridView.
The modified code is below:
hope someone finds this useful.
Richard
EDIT: Changed the BeginUpdate and EndUpdate to outside of the loop
I just wanted to share this in case anyone else had the same issue.
Scenario
+ RadGridView bound to datasource.
+ Multiselect enabled
Pre Q3 2010 you were able to loop over the rows and set each SelectedRow IsVisible property to False as below
Private
Sub
RadButton1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadButton1.Click
Try
Me
.Cursor = Cursors.WaitCursor
For
Each
row
As
GridViewRowInfo
In
Me
.RadGridView1.SelectedRows
row.IsVisible =
False
Next
Finally
Me
.Cursor = Cursors.
Default
End
Try
End
Sub
Post Q3, you can only do this if you have only 1 row selected. With multiple rows selected the RadGridView throws an InvalidOperationException (collection was modified) exception.
In order to get over this, one needs to use the BeginUpdate / EndUpdate methods of RadGridView.
The modified code is below:
Private
Sub
RadButton1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadButton1.Click
Try
Me
.Cursor = Cursors.WaitCursor
Me
.RadGridView1.BeginUpdate()
For
Each
row
As
GridViewRowInfo
In
Me
.RadGridView1.SelectedRows
row.IsVisible =
False
Next
Me
.RadGridView1.EndUpdate(
True
)
Finally
Me
.Cursor = Cursors.
Default
End
Try
End
Sub
hope someone finds this useful.
Richard
EDIT: Changed the BeginUpdate and EndUpdate to outside of the loop