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. Image for the cookie policy date
close icon

Using template class as cell combobox datasource

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



3 Replies

JJ Jisha Joy Syncfusion Team 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



CR Christian Rattat 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




JJ Jisha Joy Syncfusion Team 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

Loader.
Live Chat Icon For mobile
Up arrow icon