MultiColumnComboBox

Hi, Is there a way to set formatting of the Text property of the MultiColumnComboBox? Please consider the following: The DataSource of the MultiColumnComboBox is a DataTable with the structure: Column1- DateTime Column2 –DateTime MultiColumnComboBox.DisplayMember=”Column1”; MultiColumnComboBox.ValueMember=”Column2”; So displayed text would be in the format “mm/dd/yyyy hh:mm:ss AM/PM”, but I want it to be displayed with the “{0:d}” format. Thank you

6 Replies

AR Anupama Roy Syncfusion Team August 24, 2005 02:57 PM UTC

Hi Ivan The MultiColumnComboBox uses the GridListControl internally as its dropdown and we do not have a property to set any custom format for the Text displayed in a MultiColumnComboBox. Regards, Anu


IV Ivan August 24, 2005 03:03 PM UTC

What would be a workaround then? Thank you


AD Administrator Syncfusion Team August 25, 2005 01:17 PM UTC

Hi Ivan The display text in the grid can be formatted using QueryCellInfo event of the GridListControl Here is a sample


IV Ivan August 25, 2005 04:25 PM UTC

Thank you for the example, but it does not solve my problem. Although the grid cells are formatted, the text of the MultiColumnComboBox is not. I don''t have a source code for the control, but I suspect that the text property is set by converting the cell value to string (ToString()). Is there an event I can intercept, when the cell value is read, so I can pass the properly formatted string? Thank you


AD Administrator Syncfusion Team August 26, 2005 10:40 AM UTC

Hi Ivan, To format the text in the MultiColumnComboBox, you need not rely on grid formatting. Handling of the SelectedIndexChanged event would solve your problem. this.multiColumnComboBox1.SelectedIndexChanged += new EventHandler(multiColumnComboBox1_SelectedIndexChanged); private void multiColumnComboBox1_SelectedIndexChanged(object sender, EventArgs e) { DateTime date = System.DateTime.Parse(this.multiColumnComboBox1.Text); this.multiColumnComboBox1.Text = date.ToString("{0:d}"); } Best regards, Stanley


IV Ivan August 26, 2005 04:17 PM UTC

Thank you. I greatly appreciate your time.

Loader.
Up arrow icon