AD
Administrator
Syncfusion Team
March 19, 2007 07:30 PM UTC
Hi Tom,
There is no property setting that will handle this problem. I think the simplest way to do this is to use the CurrentCellValidateString event in grid. Below is one way you can do it.
[VB]
Dim validFormats() As String = {"MM/dd/yy","MM/dd/yyyy"} ''''your acceptable formats.
Private Sub gridDataBoundGrid1_CurrentCellValidating(sender As Object, e As System.ComponentModel.CancelEventArgs)
Dim cc As GridCurrentCell = Me.gridDataBoundGrid1.CurrentCell
If cc.ColIndex = 3 Then
Try
Dim dt As DateTime = DateTime.ParseExact(cc.Renderer.ControlText, validFormats, Nothing, System.Globalization.DateTimeStyles.None)
cc.Renderer.Control.Text = dt.ToString()
Catch
cc.ErrorMessage="Invalid Date Format"
e.Cancel=true;
End Try
End If
End Sub ''''gridDataBoundGrid1_CurrentCellValidating
Please let me know if this helps.
Regards,
Haneef