Hello
I am using two GridDateTimeColumns with Time PickerControl, I am trying to add a compare validator to one of the controls to compare the time against another control however adding the compare validator to the griddatetimecolumn throws Object Reference not set to an instance of an object exception. Below is the code I am using
does anyone had a similar issue ?? If so how did you solve it, Help!!!!!
Thanks,
Kevin
I am using two GridDateTimeColumns with Time PickerControl, I am trying to add a compare validator to one of the controls to compare the time against another control however adding the compare validator to the griddatetimecolumn throws Object Reference not set to an instance of an object exception. Below is the code I am using
Protected Sub RadGridTransCalc_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGridTransCalc.ItemCreated |
If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then |
Dim item As GridEditableItem = CType(e.Item, GridEditableItem) |
Dim editor As GridDateTimeColumnEditor = CType(item.EditManager.GetColumnEditor("END_TIME"), GridDateTimeColumnEditor) |
Dim cell As TableCell = CType(editor.PickerControl.Parent, TableCell) |
Dim validator As CompareValidator = New CompareValidator |
editor.TextBoxControl.ID = "ID_for_validation" |
validator.ControlToValidate = editor.PickerControl.ID |
validator.ControlToCompare = "START_TIME" |
validator.Operator = "GreaterThan" |
validator.Type = ValidationDataType.Date |
validator.ErrorMessage = "End time must be greater than start time" |
cell.Controls.Add(validator) |
End If |
End Sub |
On debugging I found that the following line is throwing the exception
Dim cell As TableCell = CType(editor.PickerControl.Parent, TableCell) |
does anyone had a similar issue ?? If so how did you solve it, Help!!!!!
Thanks,
Kevin