Hi.
I'd like to validate the data of a grid and display validation errors. I'm working with a DataSet and use the column errors of it.
As suggested here (http://www.telerik.com/forums/how-to-set-errortext-when-adding-a-record) I set the Grid's DataSource as a DataView but still no errors are displayed. When setting the error texts manually it works though.
Are there any other prerequisites for the Dataview's columnerrors or is it just not supported by RadGridView?
Sample code:
Friend WithEvents grd_report_ As Telerik.WinControls.UI.RadGridView
For i As Integer = 0 To row.Table.Columns.Count - 1
Select Case row.Table.Columns(i).ColumnName
Case "some column"
If error_condition Then
row.SetColumnError(i, "error")
End If
Case ...
End Select
Next
...
'doesn't display any errors
grd_report_.DataSource = ds.Tables(TAB_REPORT).DefaultView()
'setting ErrorTexts works
For Each r As GridViewRowInfo In grd_report_.Rows
Dim drv = CType(r.DataBoundItem, DataRowView)
For i As Integer = 0 To r.Cells.Count - 1
r.Cells(i).ErrorText = drv.Row.GetColumnError(i)
'has to be set in CellFormatting event apparently!?!?
'If Not String.IsNullOrEmpty(r.Cells(i).ErrorText) Then
' r.Cells(i).Style.BackColor = Color.Red
' r.Cells(i).Style.NumberOfColors = 1
' r.Cells(i).Style.DrawFill = True
'End If
Next
Next
Best regards,
Bernhard