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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Multi-column combo box in a gdbg

Thread ID:

Created:

Updated:

Platform:

Replies:

116983 Jul 15,2014 04:07 PM UTC Jul 21,2014 05:43 AM UTC WinForms 4
loading
Tags: GridDataBoundGrid(Classic)
Roberto Guerzoni
Asked On July 15, 2014 04:07 PM UTC

Hello, I tried to use as a multi-column combo box in a GridDataBoundGrid but I could not find a good example. 
I would like to show in a grid column a multi-column combo box with data from a DataTable that is not connected to the grid, 
how can I do? 
Thank you very much
Roberto Guerzoni

Maniratheenam Sehar [Syncfusion]
Replied On July 18, 2014 03:58 AM UTC

Hi Roberto Guerzoni,

 

Thank you for your interest in Syncfusion Products.

 

Query:

Multi-column combo box in a gdbg

We Would like to convey that reported query can be resolved by using GridPreviewstyleinfo event. In which by setting, the celltype as GridListControl, you can easily obtain MultiColumnCombobox in GridDataBound control.

For your better understanding, CodeSnippet is given below,

 

void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)

        {

 

           if (e.ColIndex == 2 && e.RowIndex == 3)

            {

                e.Style.CellType = GridCellTypeName.GridListControl;

                e.Style.DataSource = USStates();

                e.Style.CellValue = "US";

                e.Style.DisplayMember = "LongName";

                e.Style.ValueMember = "ShortName";

            }

        }

 

For your better convenience, we’ve added a sample below,

http://www.syncfusion.com/downloads/support/directtrac/126914/gbg-991142667.zip

 

 

Please let us know, if you’ve any further concerns.

 

Regards,

ManiRatheenam S


Roberto Guerzoni
Replied On July 18, 2014 07:30 AM UTC

Great job, thank you very much
You are fantastic support

Roberto Guerzoni
Replied On July 18, 2014 11:57 AM UTC

Hi Maniratheenam
I used the feature in a slightly different way, If it can be useful to someone here is the code that is used

public StationsForm()
{
....
//
// Format the columns in the DataTable that we will use in GridListControl associated with the column RackId
//
m_ioRacksViewDataTable.Columns["RackId"].ColumnName = CommonResource.RackId;
m_ioRacksViewDataTable.Columns["Description"].ColumnName = CommonResource.Description;
m_ioRacksViewDataTable.Columns["IPAddress"].ColumnName = CommonResource.IPAddress;
m_ioRacksViewDataTable.Columns.Remove( "IPPort" );
m_ioRacksViewDataTable.Columns.Remove( "Node" );
m_ioRacksViewDataTable.Columns.Remove( "SlaveKind" );
m_ioRacksViewDataTable.Columns.Remove( "ModbusSlaveId" );
....
}

private void StationsForm_Load( object sender, EventArgs e )
{
if( !m_initialized )
{
m_initialized = true;


assemblyStationsGrid.BeginUpdate();
assemblyStationsGrid.Binder.InternalColumns["StationId"].Position = 1;
assemblyStationsGrid.Binder.InternalColumns["StationId"].Width = 100;
assemblyStationsGrid.Binder.InternalColumns["Description"].Position = 2;
assemblyStationsGrid.Binder.InternalColumns["Description"].Width = 500;
assemblyStationsGrid.Binder.InternalColumns["IPAddress"].Position = 3;
assemblyStationsGrid.Binder.InternalColumns["IPAddress"].Width = 150;
assemblyStationsGrid.Binder.InternalColumns["RackId"].Position = 4;
assemblyStationsGrid.Binder.InternalColumns["RackId"].Width = 150;
assemblyStationsGrid.Binder.InternalColumns["CS1PositionSwitch"].Position = 5;
assemblyStationsGrid.Binder.InternalColumns["CS1PositionSwitch"].Width = 150;
assemblyStationsGrid.Binder.InternalColumns["CS2PositionSwitch"].Position = 6;
assemblyStationsGrid.Binder.InternalColumns["CS2PositionSwitch"].Width = 150;


var style = assemblyStationsGrid.Binder.InternalColumns["RackId"].StyleInfo;
style.CellType = GridCellTypeName.GridListControl; // TIP - MultiColumnComboBox
style.DropDownStyle = GridDropDownStyle.Exclusive; TIP - Comment out the line if you want to allow editing of the column
style.DataSource = m_ioRacksViewDataTable;
style.DisplayMember = CommonResource.RackId;
style.ValueMember = CommonResource.RackId;
//style.ShowButtons = GridShowButtons.ShowCurrentRow; // TIP-Uncomment theline if you want the grid to display the selection buttons only in selected row
style.HorizontalAlignment = GridHorizontalAlignment.Left;
assemblyStationsGrid.EndUpdate();
}
}

Maniratheenam Sehar [Syncfusion]
Replied On July 21, 2014 05:43 AM UTC

Hi Roberto Guerzoni,

 

Thanks for the update.

We are glad that your issue has been resolved.

 

Regards,

ManiRatheenam S


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.

Warning Icon 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.Close Icon

;