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

Using template class as cell combobox datasource

Thread ID:

Created:

Updated:

Platform:

Replies:

99602 May 31,2011 01:14 PM UTC Jun 14,2011 03:42 AM UTC Windows Forms 3
loading
Tags: GridControl
Christian Rattat
Asked On May 31, 2011 01:14 PM UTC

Hi,

I'm trying to create a generic control derived from gridcontrol that uses IList as datasource for cell comboboxes. But the grid control tells me that I can only use IList or ISourceList. Is there a way to use generics anyway? I need to support list items in the comboboxes that have a string as displaymember but different value types that I don't know at compile time and I don't want to handle values as non typed objects.

Regards,
Christian



Jisha Joy [Syncfusion]
Replied On June 6, 2011 09:12 AM UTC

Hi,


Please refer to the following sample from our sample browser that illustrates the usage of ComboBox and MulticolumnGridList controls in grid cells. The dropdownlist can be populated with items in the following ways:

Through GridStyleInfo.ChoiceList property
Through GridStyleInfo.DataSource property


Sample location,

..\Windows\Grid.Windows\Samples\2.0\Cell Types\Combo Box Cell Demo\cs

Please refer to it and let me know if this helps.

Regards,
Jisha


Christian Rattat
Replied On June 8, 2011 12:28 PM UTC

Hi,

thanks for the feedback. I'm aware of how using dropdowns in cells and were already using it for quite some time. The problem I have is not creating comboboxes but using a C# template class as datasource.

I don't want to use an arraylist or other containers from specialized collections because it does not use the actual types but object and does a lot of boxing/unboxing.

I want to use as container an implementation of IList. When I set

grid[row,col].DataSource = new IList;

I get an error telling me that I can use IList as datasource. So the question is whether I can use generics as datasource or if I still have to use depricated classes like arraylist here.

Regards,
Christian



Jisha Joy [Syncfusion]
Replied On June 14, 2011 03:42 AM UTC

Hi Christian,

Please refer to the following attached sample, that uses a template class as a datasource to the dropdown in grid cell,

Regards,
Jisha



GGCListControl_a2a10c70.zip

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

;