improve validation, switch to inline error marker again

This commit is contained in:
Jonathan Jenne
2021-03-24 14:29:47 +01:00
parent 4e01de4f66
commit 7a976ac08b
2 changed files with 42 additions and 29 deletions

View File

@@ -409,7 +409,7 @@ Public Class ClassControlCreator
Public Shared Function CreateExistingGridControl(row As DataRow, DT_MY_COLUMNS As DataTable, designMode As Boolean) As GridControl
Dim oControl As GridControl = CreateBaseControl(New GridControl(), row, designMode)
Dim oDatatable As New DataTable
Dim oView As DevExpress.XtraGrid.Views.Grid.GridView
Dim oView As GridView
oControl.ForceInitialize()
@@ -555,19 +555,23 @@ Public Class ClassControlCreator
Where r.Item("SPALTENNAME") = oCol.ColumnName
Select r).FirstOrDefault()
Dim oGridColumn As GridColumn = (From c As GridColumn In oView.Columns
Where c.FieldName = oCol.ColumnName
Select c).FirstOrDefault()
Dim oIsRequired = oColumn.Item("VALIDATION")
Dim oValue = NotNull(oView.GetRowCellValue(e.RowHandle, oCol.ColumnName), "")
If oIsRequired And oValue = "" Then
oView.SetColumnError(oGridColumn, "Spalte muss ausgefüllt werden!")
e.Valid = False
e.ErrorText = $"Spalte {oColumn.Item("SPALTEN_HEADER")} muss ausgefüllt werden!"
Exit For
End If
Next
End Sub
AddHandler oView.InvalidRowException, Sub(sender As Object, e As InvalidRowExceptionEventArgs)
e.ExceptionMode = ExceptionMode.DisplayError
e.ExceptionMode = ExceptionMode.NoAction
End Sub
AddHandler oView.ValidatingEditor, Sub(sender As Object, e As BaseContainerValidateEditorEventArgs)