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.
Syncfusion Feedback

How to add Popupcontrol to dropdown of ComboBox

Thread ID:

Created:

Updated:

Platform:

Replies:

129975 Apr 13,2017 04:09 AM UTC Apr 20,2017 01:50 PM UTC Windows Forms 3
loading
Tags: GridGroupingControl
Truong
Asked On April 13, 2017 04:09 AM UTC

this.gridGroupingControl1.TableDescriptor.Columns["Description"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.Combobox; How can i add a popupcontrol to this combobox , and custom this popupcontrol such as popupcontrol high, width , datasource Thank for read and helping me!!!!

Piruthiviraj Malaimelraj [Syncfusion]
Replied On April 14, 2017 06:38 AM UTC

Hi Truong, 

Thanks for the update. 
 
Query 
Response 
 
 
 
 
 
 
 
 
 
 
How can i add a popupcontrol to this combobox and custom this popupcontrol such as popupcontrol high, width , datasource 
We could able to understand your scenario and created the simple sample as per your requirement. You can add the custom controls as you want in ComboBox DropDown by adding the controls in the GridComboBoxCellRenderer.DropDownContainer and also you can customize the dropdown width and height by using e.Inner.Size property in TableControlCurrentCellShowingDropDown event. 
 
 
Code example: 
void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellShowingDropDownEventArgs e) 
{ 
    GridComboBoxCellRenderer renderer = e.TableControl.CurrentCell.Renderer as GridComboBoxCellRenderer; 
    
    ComboBox combo = new ComboBox(); 
    combo.DataSource = dt; 
    combo.DisplayMember = "Value"; 
    combo.ValueMember = "ID"; 
 
    //Remove the default control 
    renderer.DropDownContainer.Controls.RemoveAt(0); 
      
    //Add the GridControl in DropDown. 
    renderer.DropDownContainer.Controls.Add(combo); 
 
    //Change the DropDown width and Height. 
    e.Inner.Size = new Size(200, e.Inner.Size.Height); 
} 


If you want to add the custom controls (i.e GridControl,Calculator, etc.) ,please refer to the dash boards samples from below location,  
<InstalledLocation\Syncfusion\EssentialStudio\VersionNumber\Windows\Grid.Windows\Samples\Custom Cell Types\Drop Down Cell Demo\CS> 

If you want to add the GridListControl directly into ComboBox, please refer to the dash board sample from below location, 
<InstalledLocation\Syncfusion\EssentialStudio\VersionNumber\Windows\Grid.Windows\Samples\Grid List Control\Drop-Down Grid Demo\CS> 
 
Sample link: 

Regards, 
Piruthiviraj 


Truong
Replied On April 19, 2017 08:37 AM UTC

I tried to add GridlistControl but it is not woriking:

 GridComboBoxCellRenderer renderer = e.TableControl.CurrentCell.Renderer as GridComboBoxCellRenderer;
            //Remove the default control 
            renderer.DropDownContainer.Controls.RemoveAt(0);

            //Add the GridControl in DropDown. 
            renderer.DropDownContainer.Controls.Add(gridNguyenLieu);

            //Change the DropDown width and Height. 
            e.Inner.Size = new Size(200, e.Inner.Size.Height); 

I want to add this grid as same as add grid to popupcontrol of combodropdown:

           cbo_HangHoaCha.PopupControl = gridHangHoaCha;


Mohanraj Gunasekaran [Syncfusion]
Replied On April 20, 2017 01:50 PM UTC

Hi Truong, 
 
Thanks for your update. 
 
We can reproduce your scenario. By default, GridListControl size as 0 when initialize the grid. So, the size should be defined before the GridListControl initialization then only which can visible in drop down container. Please refer to the below code example and the attached sample, 
 
Code example 
GridComboBoxCellRendererrenderer = e.TableControl.CurrentCell.Renderer as GridComboBoxCellRenderer; 
             
GridListControl list = new GridListControl(); 
list.DataSource = dt; 
list.DisplayMember = "Value"; 
list.ValueMember = "ID"; 
list.Dock = DockStyle.Fill; 
//(Or) 
//list.Size = new System.Drawing.Size(100, 60); 
//Remove the default control 
renderer.DropDownContainer.Controls.RemoveAt(0); 
//Add the GridControl in DropDown. 
renderer.DropDownContainer.Controls.Add(list); 
             
e.Inner.Size = new Size(200, e.Inner.Size.Height); 
 
Sample link: GridGroupingControl 
 
 
Note: 
By default, GridGroupingControl having the support for GridListCotrol cell type so you can directly use this CellType for grid cells. Please refer to the below code example, 
 
Code example 
this.gridGroupingControl1.TableDescriptor.Columns["Description"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.GridListControl; 
 
Regards, 
Mohanraj G 
 


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

;