Hello
I have a databound gridview in which I change two columns from standard cell to dropdown cells
So far everything is fine, when I select a value in the dropdownlist, the grid is properly updated.
However I need to validate the user's selection from the dropdown list and cancel the change if not authorized based on various conditions.
I have tried various methods, such as using the callvalidating or cellvaluechanged events but I have not managed to cancel the change when not authorized. Moreover in some cases the dropdown is no longer available.
As a workaround I perform the check in the cellvaluechanged event reload completely the grid when the change is not authorized but this is far from being efficient.
Herebelow the code snipet of the celvaluechanged event
----------------------------------------------------------------------------------------------------------------------------------------------
Select Case e.Column.Name
Case "Ctrldd"
Dim mEntry As New mEntry(MyConnectionString)
mEntry.UpdateCtrl(context, theEntry.idEntry, e.Value)
ShowEntryDetails(theEntry.idEntry)
Case "HCdd"
Dim mEntry As New mEntry(MyConnectionString)
If mEntry.CheckHCChange(theEntry, theCompetition.Label.Scope) Then
mEntry.UpdateHC(context, theEntry.idEntry, e.Value)
ShowEntryDetails(theEntry.idEntry)
Else
MessageBox.Show(My.Resources.Entry.ChangeHCNotAllowed, My.Resources.Main.WarningMsg, MessageBoxButtons.OK, MessageBoxIcon.Information)
'request a reload of the grid
RaiseEvent RefreshRequired()
End If
End Select
----------------------------------------------------------------------------------------------------------------------------------------------
Thanks in advance for any advice
Pierre-Jean