Background:
- I have a gridview column subscribing to EditorRequired event.
- In the EditorRequired function, it will either prompt DropDownList or RadDateTimeEditor.
(Please refer attached for sample project)
private void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e)
{
if (this.radGridView1.CurrentColumn.Name == "Value" && this.radGridView1.CurrentRow.Cells[2].Value.ToString() == "DropDown")
{
RadDropDownListEditor editor = new RadDropDownListEditor();
RadDropDownListEditorElement element = editor.EditorElement as RadDropDownListEditorElement;
element.DropDownStyle = RadDropDownStyle.DropDownList;
element.AutoSizeItems = true;
var selection = this.radGridView1.CurrentRow.Cells[3].Value.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
element.DataSource = selection;
e.Editor = editor;
}
else if (this.radGridView1.CurrentColumn.Name == "Value" && this.radGridView1.CurrentRow.Cells[2].Value.ToString() == "Date")
{
RadDateTimeEditor editor = new RadDateTimeEditor();
editor.CustomFormat = "dd-MMM-yyyy";
e.Editor = editor;
}
}
Question:
- How to define the Date format?
I have tried to set the CustomFormat but the format remains as shown in the screenshot above.
RadDateTimeEditor editor = new RadDateTimeEditor();
editor.CustomFormat = "dd-MMM-yyyy";
e.Editor = editor;