The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
In a grid, can a MonthCalendar control column, bound to a SQL date field, be formatted to accept a 6 or 8 digit numeric date (031607 or 03162007) and supply the slashes and century if necessary?
ADAdministrator 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