We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

how to reorder columns in multicolumncombobox

Thread ID:

Created:

Updated:

Platform:

Replies:

62373 Jun 13,2007 03:05 PM Jun 13,2007 11:45 PM Windows Forms 1
loading
Tags: Tools
Kamen Yotov
Asked On June 13, 2007 03:05 PM

i am playing with multicolumncombobox.
i am data-binding an array of custom created objects as a data-source and their public properties show as column (as the documentation says).

how do i choose the order in which the columns appear? it is not related to the order the properties are declared in the source...

JayaLakshmi [Syncfusion]
Replied On June 13, 2007 11:45 PM

Hi Kamen,

Thank you for using Syncfusion products.

You can achieve the reordering of the columns by storing the column information in a Hashtable and by handling Grid_PrepareViewStyleInfo event.

Here is the code snippet.

this.multiColumnComboBox1.ListBox.Grid.PrepareViewStyleInfo+=new Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);

Hashtable hash = new Hashtable();
void Grid_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
GridControl grid = sender as GridControl;
if (hash.Contains(e.ColIndex))
{
if (hash[e.ColIndex] != null)
{
e.Style.CellValueType = grid[e.RowIndex, int.Parse(hash[e.ColIndex].ToString())].CellValueType;
e.Style.Text = grid[e.RowIndex, int.Parse(hash[e.ColIndex].ToString())].Text;
}
}
}

Please refer the sample in the below link and let me know if this helps.

http://websamples.syncfusion.com/samples/Tools.Windows/F61776_1/main.htm

Regards,
Jaya

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;