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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

MultiColumnComboBox display columns

Thread ID:

Created:

Updated:

Platform:

Replies:

144457 May 7,2019 02:37 PM UTC May 9,2019 09:38 AM UTC WinForms 3
loading
Tags: MultiColumnComboBox
Alan Oliveira
Asked On May 7, 2019 02:37 PM UTC

Hello,

I wanted to know how to be able to customize which columns will be displayed in the "MultiColumnComboBox" component. I did not find any properties to customize. If there is any option please inform me.

Ex: I have a table with several fields and only need to display 3 fields. "Code, Initial Value and Final Value"


Att,
Alan

Jagadeesan Pichaimuthu [Syncfusion]
Replied On May 8, 2019 07:08 AM UTC

Hi Alan, 
 
Thanks for using Syncfusion product. 
 
You can able to customize which columns to be displayed in MultiSelectionComboBox by setting the MultiColumnComboBox1.ListBox.Grid.Model.Cols.Hidden[“Column Name”] to true. In which above property, you can able to set the true for the columns which you don’t want to show. Please find the below code snippet where totally 5 columns are available in table, but two columns are hidden. 
 
dt.Columns.Add("S.No"); 
dt.Columns.Add("FirstName"); 
dt.Columns.Add("LastName"); 
dt.Columns.Add("Occupation"); 
dt.Columns.Add("Place"); 
// Create a Data Set 
DataSet ds = new DataSet(); 
ds.Tables.Add(dt); 
dt.Rows.Add(new string[] { "1", "Alex", "Zen", "Doctor", "Italy" }); 
dt.Rows.Add(new string[] { "2", "Bob", "Harry", "Staff", "London" }); 
dt.Rows.Add(new string[] { "3", "Alice", "Peter", "Developer", "US" }); 
dt.Rows.Add(new string[] { "4", "Adlensha", "Fdo", "Staff", "Italy" }); 
dt.Rows.Add(new string[] { "5", "Brick", "John", "Nurse", "North America" }); 
dt.Rows.Add(new string[] { "6", "Collen", "Geo", "Developer", "India" }); 
this.multiColumnComboBox1.DataSource = dt; 
this.multiColumnComboBox1.DisplayMember = "Place"; 
this.multiColumnComboBox1.SelectedIndexChanged += new EventHandler(multiColumnComboBox1_SelectedIndexChanged); 
 
this.multiColumnComboBox1.ListBox.Grid.Model.Cols.Hidden["S.No"] = true; 
this.multiColumnComboBox1.ListBox.Grid.Model.Cols.Hidden["LastName"] = true; 
 
 
 
Please find the sample for your reference. 
 
Also refer the below documentation for your reference. 
 
Let us know whether this helps also if you need any further assistance on this. 
 
Regards, 
Jagadeesan 


Alan Oliveira
Replied On May 8, 2019 10:23 PM UTC

Hi Jagadeesan,

In my case I have a template "SimpleFrameFilter" as I determine which columns would be displayed without using the hidden method. I tried using the hidden plus the columns did not get organized 

Display: "FaixaInicial, FaixaFinal "

public class TabelaFaixaFatSimples : ModeloBase
    {
        [DataType(DataType.Currency)]
        public virtual decimal FaixaInicial { get; set; }
        [DataType(DataType.Currency)]
        public virtual decimal FaixaFinal { get; set; }
        public virtual decimal Aliquota { get; set; }
        public virtual decimal IRPJ { get; set; }
        public virtual decimal CSLL { get; set; }
        public virtual decimal COFINS { get; set; }
        public virtual decimal PIS_PASEP { get; set; }
        public virtual decimal CPP { get; set; }
        public virtual decimal ICMS { get; set; }
        public virtual decimal IPI { get; set; }
        public virtual decimal ISS { get; set; }
        public virtual decimal PercReducaoBC { get; set; }
}

Sabaridass Ramamoorthy [Syncfusion]
Replied On May 9, 2019 09:38 AM UTC

Hi Alan, 

Sorry for the inconvenience caused. 

By default, you can hide the column by setting the Browsable attribute as false. To display the specific column, you could change the Browsable attribute as true for that specified column. Please refer the following code example. 

C# 
List<String> SimpleFrameFilter = new List<String>(); 
SimpleFrameFilter.Add("FaixaInicial"); 
SimpleFrameFilter.Add("FaixaFinal"); 
this.changeBrowsableAttribute(typeof(TabelaFaixaFatSimples), SimpleFrameFilter); 
this.multiColumnComboBox1.DataSource = collection; 
 
private void changeBrowsableAttribute(Type wallTypeToMakeSheathingVisible, List<String> columns) 
{ 
    foreach (var col in columns) 
    { 
        PropertyDescriptor descriptor = TypeDescriptor.GetProperties(wallTypeToMakeSheathingVisible)[col]; 
        BrowsableAttribute attrib = (BrowsableAttribute)descriptor.Attributes[typeof(BrowsableAttribute)]; 
        FieldInfo isBrow = attrib.GetType().GetField("browsable", BindingFlags.NonPublic | BindingFlags.Instance); 
        isBrow.SetValue(attrib, true); 
    } 
} 
 
public class TabelaFaixaFatSimples 
{ 
    [Browsable(false)] 
    public virtual decimal FaixaInicial { get; set; } 
    [Browsable(false)] 
    public virtual decimal FaixaFinal { get; set; } 
    [Browsable(false)] 
    public virtual decimal Aliquota { get; set; } 
    [Browsable(false)] 
    public virtual decimal IRPJ { get; set; } 
    [Browsable(false)] 
    public virtual decimal CSLL { get; set; } 
    [Browsable(false)] 
    public virtual decimal COFINS { get; set; } 
    [Browsable(false)] 
    public virtual decimal PIS_PASEP { get; set; } 
    [Browsable(false)] 
    public virtual decimal CPP { get; set; } 
    [Browsable(false)] 
    public virtual decimal ICMS { get; set; } 
    [Browsable(false)] 
    public virtual decimal IPI { get; set; } 
    [Browsable(false)] 
    public virtual decimal ISS { get; set; } 
    [Browsable(false)] 
    public virtual decimal PercReducaoBC { get; set; } 
} 
 
 
Please get back to us if you need any further assistance on this. 

Regards, 
Sabaridass R 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon