This is a migrated thread and some comments may be shown as answers.

Binding data into radMulti Column ComboBox

9 Answers 287 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
pogy
Top achievements
Rank 1
pogy asked on 28 Mar 2014, 07:20 AM
I have list of `NetworkAdapter` object that represent my machine `Network adapter`:

        List<NetworkAdapter> adaptersList
    
        public class NetworkAdapter
        {
            public string Name { get; set; }
            public string ID { get; set; }
            public string Description { get; set; }
            public string IPAddress { get; set; }
            private string gatewayIpAddress;
            public string Speed { get; set; }
            public string NetworkInterfaceType { get; set; }
            public string MacAddress { get; set; }
       }

And i want to bonding every obkect from the list with all its properties into my `radMulti Column ComboBox`

This is what i have try:

    radMultiColumnComboBoxTest.DataSource = adaptersList;

This is the result:



Any idea how to fix it in order to see every object from the list with all its properties instead of columns ?

9 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 28 Mar 2014, 07:46 AM
Hi Pogy,

Thank you for writing.

Please refer to the following article which explains how to populate RadGridView (RadMultiColumnComboBox respectively) with data from an object and keep them in sync: http://www.telerik.com/help/winforms/gridview-populating-with-data-reflecting-custom-object-changes-in-rgv.html.

I hope this helps.

Regards,
Stefan
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
pogy
Top achievements
Rank 1
answered on 28 Mar 2014, 08:42 AM
But this exactly what i am did.

instead of List<Student> collectionOfStudents = new List<Student>(); i have my List: List<NetworkAdapter> adaptersList

and instead of this.radGridView1.DataSource = collectionOfStudents; --> radMultiColumnComboBoxTest.DataSource = adaptersList;
0
pogy
Top achievements
Rank 1
answered on 28 Mar 2014, 08:48 AM
I want to show all my object properties without any columns like this example:

http://www.telerik.com/sfimages/default-source/productsimages/winforms/productitemfeatures/radcomboboxwin_double_click1.png?sfvrsn=0
0
Stefan
Telerik team
answered on 31 Mar 2014, 07:40 AM
Hi Pogy,

I am not sure why you are not able to bind your control as in the example provided. I made a small test and everything seems to be working on my end:
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
 
    radMultiColumnComboBox1 = new RadMultiColumnComboBox();
    radMultiColumnComboBox1.Width = 300;
    radMultiColumnComboBox1.Parent = this;
 
    List<NetworkAdapter> adaptersList = new List<NetworkAdapter>();
 
    for (int i = 0; i < 10; i++)
    {
        NetworkAdapter adapter = new NetworkAdapter();
        adapter.Name = "name " + i;
        adapter.ID = i.ToString();
        adapter.Description = "Some desc" + i;
 
        adaptersList.Add(adapter);
    }
 
    radMultiColumnComboBox1.DataSource = adaptersList;
}

To show all your object properties, without columns in separate controls, you can use RadDropDownList control. You should add as many control as you need and you should bind each one of them to the desired object property. Here is the control's documentation: http://www.telerik.com/help/winforms/dropdown-and-listcontrol-dropdownlist-overview.html. As this control internally hosts RadListControl, the latter documentation is also valid for RadDropDownList. Also, here is the place to read for the control's binding: http://www.telerik.com/help/winforms/dropdown-and-listcontrol-listcontrol-databinding.html

I hope this helps.

Regards,
Stefan
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
pogy
Top achievements
Rank 1
answered on 31 Mar 2014, 06:18 PM
Thanks a lot for your response..

currently your code behave same as mind and all i want to do is to remove the column but using MultiColumnComboBox
is it possible ?
0
pogy
Top achievements
Rank 1
answered on 31 Mar 2014, 06:27 PM
I also try to concatenate strings to show all my Network Adapter properties:

        private void test()
        {
            string str = "";
            for (int i = 0; i < adaptersList.Count; i++)
            {
                str += adaptersList[i].Name + Environment.NewLine +
                    adaptersList[i].ID + Environment.NewLine +
                    adaptersList[i].Description + Environment.NewLine;
            }

            radMultiColumnComboBox1.DataSource = str;
        }

But the result was that the MultiComboBox was empty (no data to display) and the combobox header was Telerik.WinControls.Ui.GridViewDataRowInfo





0
pogy
Top achievements
Rank 1
answered on 31 Mar 2014, 07:15 PM
Can you show me please hot to define simple RadMultiColumnComboBox like this:

http://www.telerik.com/sfimages/default-source/productsimages/winforms/productitemfeatures/radcomboboxwin_double_click1.png?sfvrsn=0

All i want to do is to show few strings lines inside each index (no pic no nothing else)
0
Stefan
Telerik team
answered on 01 Apr 2014, 07:37 AM
Hello Pogy,

If I understand correctly, you would like in оnе and the same item, to display the information from all properties of your object. Until now I thought you want to present your data in a grid like format, as you constantly mention RadMultiColumnComboBox, which internally contains a grid.

To achieve the scenario with the custom item, holding information about your object, you will need to use RadDropDownList with custom visual item. The following article describes how such can be created: http://www.telerik.com/help/winforms/dropdown-and-listcontrol-listcontrol-visual-data-representation.html.

Alternatively, if you just want to concatenate the property settings and display them below, you can use the 
DescriptionTextListDataItem. Here is a small example of this:
protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
 
            RadDropDownList ddl = new RadDropDownList();
            ddl.Parent = this;
            ddl.AutoSizeItems = true;
 
            List<NetworkAdapter> adaptersList = new List<NetworkAdapter>();
 
            for (int i = 0; i < 10; i++)
            {
                NetworkAdapter adapter = new NetworkAdapter();
                adapter.Name = "name " + i;
                adapter.ID = i.ToString();
                adapter.Description = "Some desc" + i;
 
                adaptersList.Add(adapter);
            }
 
            for (int i = 0; i < adaptersList.Count; i++)
            {
                string str = adaptersList[i].Name + Environment.NewLine +
                    adaptersList[i].ID + Environment.NewLine +
                    adaptersList[i].Description + Environment.NewLine;
 
                DescriptionTextListDataItem descItem = new DescriptionTextListDataItem();
                descItem.Text = "Main text";
                descItem.DescriptionText = str;
                ddl.Items.Add(descItem);
            }
        }

Let me know how this works for you.

Regards,
Stefan
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
pogy
Top achievements
Rank 1
answered on 01 Apr 2014, 08:25 AM
Yes !
that's exactly what i want to achieve, thanks a lot for your help !
Tags
MultiColumn ComboBox
Asked by
pogy
Top achievements
Rank 1
Answers by
Stefan
Telerik team
pogy
Top achievements
Rank 1
Share this question
or