or
rgvResults.MasterTemplate.EnableFiltering =
True
Dim
filter
As
New
FilterDescriptor()
filter.PropertyName =
"attrib_exists"
filter.[Operator] = FilterOperator.IsEqualTo
filter.Value =
"Y"
filter.IsFilterEditor =
True
rgvResults.MasterTemplate.FilterDescriptors.Add(filter)
rgvResults.MasterTemplate.Columns(
"attrib_exists"
).FilterDescriptor = filter
rgvResults.MasterTemplate.Refresh()
Private
Sub
grid2_RowValidating(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.WinControls.UI.RowValidatingEventArgs)
Handles
grid2.RowValidating
If
TypeOf
e.Row
Is
GridViewNewRowInfo
Or
TypeOf
e.Row
Is
GridViewDataRowInfo
Then
If
Not
e.Row
Is
Nothing
Then
Dim
value
As
String
= e.Row.Cells(1).Value
If
value > 10
Then
e.Cancel =
True
e.Row.Cells(1).ErrorText =
"cannot be greater than 10"
e.Row.ErrorText =
"cannot be greater than 10"
e.Row.Cells(1).Style.ForeColor = Color.Red
'These did not work so had to use the cell formating
'e.Row.Cells(1).Style.DrawFill = True
'e.Row.Cells(1).Style.NumberOfColors = 1
'e.Row.Cells(1).Style.BackColor = Color.Peru
'e.Row.Cells(1).Style.DrawBorder = True
'e.Row.Cells(1).Style.BorderWidth = 2
Else
e.Row.ErrorText =
String
.Empty
End
If
End
If
End
If
End
Sub
Private
Sub
grid2_ViewCellFormatting(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.WinControls.UI.CellFormattingEventArgs)
Handles
grid2.ViewCellFormatting
If
grid2.IsInEditMode
Then
If
TypeOf
e.Row
Is
GridViewRowInfo
Then
Select
Case
e.ColumnIndex
Case
1
e.CellElement.DrawFill =
True
e.CellElement.NumberOfColors = 1
'validate again?? to set the coloring?
If
e.CellElement.Value > 10
Then
'set visual clue
e.CellElement.BackColor = Color.Peru
e.CellElement.ForeColor = Color.Yellow
e.CellElement.Image = My.Resources._error
Else
'reset all
e.CellElement.BackColor = Color.White
e.CellElement.ForeColor = Color.Black
e.CellElement.Image =
Nothing
End
If
End
Select
End
If
End
If
End
Sub