Change Editor Date Format of a column at runtime.

2 posts, 0 answers
  1. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 03 May 2013 Link to this post

    Please is there a solution somewhere to that problem which even a Support ticket has no result !
    I have a GridViewDatacolumn which is of type Date and I can change the DataFormatstring at runtime but when I edit the cell it reverts back to en-US.

    Whern the user change language to french I change the Date format to "dd-MM-yyyy" and when he selects english, I change it to "MM-dd-yyyy".  It works find for the visual but the editor is always in "MM-dd-yyyy" 

    To date after almost 2 days with MANY hours and a Support ticket that leads no where to date, I'm still looking.
    Please someone what is the secret little thing I have to do to have the editor in the same format as the cell display info

  2. Vanya Pavlova
    Vanya Pavlova avatar
    2019 posts

    Posted 07 May 2013 Link to this post

    Hello Marc,

    We have already replied to your support ticket. For those members of the community, who might be interested in your case I am posting the answer here, as follows:

    You may try to handle PreparingCellForEdit/ PreparedCellForEdit events of RadGridView from where you may access the corresponding Editing Element.
    Once you get the RadDateTimePicker instance you can set the date format by changing the Culture property, something like the following:

    private void clubsGrid_PreparingCellForEdit(object sender, GridViewPreparingCellForEditEventArgs e)
            if ((string) e.Column.Header == "Date")
                    var rdt = e.EditingElement as RadDateTimePicker;
                    rdt.Culture = new CultureInfo("en-US")
                         DateTimeFormat = new DateTimeFormatInfo
                         ShortDatePattern = "dd-MMM-yyyy"

    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top