nyarlathotep
Member
- Joined
- Mar 23, 2012
- Messages
- 6
- Programming Experience
- 1-3
Hi again.
In an ideal world I'd like to present a datagrid to users which allows multi-selection but contains some rows they can't select. This is an extension of the multigrid custom control I got working with help here.
The user want to be able to see all the values in the underlying data table, but I want to prevent them from adding certain rows to the selected rows collection, and pop up a message box to explain why they can't.
Google suggests this is not at all easy, but that I might make some progress overriding the setselectedrowcore method. Is it simply a case of code like this, or it this approach a terrible idea?
In an ideal world I'd like to present a datagrid to users which allows multi-selection but contains some rows they can't select. This is an extension of the multigrid custom control I got working with help here.
The user want to be able to see all the values in the underlying data table, but I want to prevent them from adding certain rows to the selected rows collection, and pop up a message box to explain why they can't.
Google suggests this is not at all easy, but that I might make some progress overriding the setselectedrowcore method. Is it simply a case of code like this, or it this approach a terrible idea?
VB.NET:
Protected Overrides Sub SetSelectedRowCore(rowIndex As Integer, selected As Boolean)
If (test on row contents) then
MsgBox("You can't do that")
Exit Sub
Else
MyBase.SetSelectedRowCore(rowIndex, selected)
End If
End Sub