Validation, More Lookup Grid Control Tweaks
This commit is contained in:
@@ -547,37 +547,37 @@ Public Class ClassControlCreator
|
||||
Next
|
||||
End Sub
|
||||
|
||||
'AddHandler oView.CellValueChanged, Sub(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs)
|
||||
' Console.WriteLine("")
|
||||
' End Sub
|
||||
AddHandler oView.ValidateRow, Sub(sender As Object, e As ValidateRowEventArgs)
|
||||
Dim oRow As DataRowView = oView.GetRow(oView.FocusedRowHandle)
|
||||
|
||||
'AddHandler oView.ValidateRow, Sub(sender As Object, e As ValidateRowEventArgs)
|
||||
' Console.WriteLine("")
|
||||
' End Sub
|
||||
For Each oCol As DataColumn In oRow.DataView.Table.Columns
|
||||
Dim oColumn As DataRow = (From r As DataRow In DT_MY_COLUMNS.Rows
|
||||
Where r.Item("SPALTENNAME") = oCol.ColumnName
|
||||
Select r).FirstOrDefault()
|
||||
|
||||
'AddHandler oView.ValidatingEditor, Sub(sender As Object, e As BaseContainerValidateEditorEventArgs)
|
||||
' Dim oRow As DataRowView = oView.GetRow(oView.FocusedRowHandle)
|
||||
Dim oIsRequired = oColumn.Item("VALIDATION")
|
||||
Dim oValue = NotNull(oView.GetRowCellValue(e.RowHandle, oCol.ColumnName), "")
|
||||
|
||||
' For Each oCol As DataColumn In oRow.DataView.Table.Columns
|
||||
' Dim oColumn As DataRow = (From r As DataRow In DT_MY_COLUMNS.Rows
|
||||
' Where r.Item("SPALTENNAME") = oCol.ColumnName
|
||||
' Select r).FirstOrDefault()
|
||||
If oIsRequired And oValue = "" Then
|
||||
e.Valid = False
|
||||
e.ErrorText = $"Spalte {oColumn.Item("SPALTEN_HEADER")} muss ausgefüllt werden!"
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
' Dim oIsRequired = oColumn.Item("VALIDATION")
|
||||
' Dim oValue As String = NotNull(e.Value, "")
|
||||
AddHandler oView.InvalidRowException, Sub(sender As Object, e As InvalidRowExceptionEventArgs)
|
||||
e.ExceptionMode = ExceptionMode.DisplayError
|
||||
End Sub
|
||||
|
||||
' If oValue.contains(" | ") Then
|
||||
' oValue = oValue.Split(" | ").ToList().First()
|
||||
' e.Value = oValue
|
||||
' End If
|
||||
AddHandler oView.ValidatingEditor, Sub(sender As Object, e As BaseContainerValidateEditorEventArgs)
|
||||
Dim oValue As String = NotNull(e.Value, "")
|
||||
|
||||
' If oIsRequired And oValue = "" Then
|
||||
' e.Valid = False
|
||||
' e.ErrorText = $"Spalte {oColumn.Item("SPALTEN_HEADER")} muss ausgefüllt werden!"
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
' End Sub
|
||||
If oValue.Contains(" | ") Then
|
||||
oValue = oValue.Split(" | ").ToList().First()
|
||||
e.Value = oValue
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Return oControl
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user