Typing Date

3 posts, 0 answers
  1. Mark
    Mark avatar
    16 posts
    Member since:
    Jul 2015

    Posted 05 Oct 2015 Link to this post

    Having complains from users when typing in a date for a GridViewDateTimeColumn

    On the RadDateTimePicker there is an option called AutoSelectNextPart  (see code below)

    Can this be used with the gridview, GridViewDateTimeColumn?

    Many Thanks


    Dim provider As MaskDateTimeProvider = TryCast(Me.dtpContractSigned.DateTimePickerElement.TextBoxElement.Provider, MaskDateTimeProvider)
    provider.AutoSelectNextPart = True

  2. Ralitsa
    Ralitsa avatar
    192 posts

    Posted 06 Oct 2015 Link to this post

    Hi Mark,

    Thank you for contacting us. 

    In Q2 2014 (2014.2.617) we added the AutoSelectNextPart property to the MaskDateTimeProvider. You can set the AutoSelectNextPart property to true in the CellEditorInitialized event handler for GridViewDateTimeColumn. Please refer to the code snippet below:
    Partial Public Class Form1
    Inherits Form
        Public Sub New()
            Dim dateTimeColumn As New GridViewDateTimeColumn()
            dateTimeColumn.Name = "OrderDate"
            dateTimeColumn.HeaderText = "OrderDate"
            dateTimeColumn.FieldName = "OrderDate"
            dateTimeColumn.Width = 200
            dateTimeColumn.Format = DateTimePickerFormat.[Custom]
            dateTimeColumn.CustomFormat = "MM/dd/yyyy"
            dateTimeColumn.FormatString = "{0:MM/dd/yyyy}"
            For i As Integer = 0 To 4
            Me.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill
            AddHandler Me.radGridView1.CellEditorInitialized, AddressOf radGridView1_CellEditorInitialized
        End Sub
        Private Sub radGridView1_CellEditorInitialized(sender As Object, e As GridViewCellEventArgs)
            If TypeOf e.ActiveEditor Is RadDateTimeEditor Then
                Dim editor As RadDateTimeEditor = TryCast(e.ActiveEditor, RadDateTimeEditor)
                Dim element As RadDateTimeEditorElement = TryCast(editor.EditorElement, RadDateTimeEditorElement)
                Dim provider As MaskDateTimeProvider = TryCast(element.TextBoxElement.Provider, MaskDateTimeProvider)
                provider.AutoSelectNextPart = True
            End If
        End Sub
    End Class

    Hope this will help you. Let me know if you have any other questions.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Mark
    Mark avatar
    16 posts
    Member since:
    Jul 2015

    Posted 06 Oct 2015 in reply to Ralitsa Link to this post

    Many Thanks.


Back to Top