Windows XP Pro / NetAdvantage 7.1.20071.40 / Windows Forms Application / .Net 2.0 / C#
I am looking to have a grid cell display a UltraDropDown control. I want the drop down to display a sequence of years which can be selected or unselected (ideally using multi select).
The list starts off with every year within a range being selected. The WinGrid cell display for this is 'startYear - endYear' where startYear and endYear are the bounds of the range - ie. "1960 - 2006".
The user wants to be able to click in the WinGrid on that cell and have all the years from 1960 to 2006 show up in a drop down box. They can then unselect years. When the user finishes unselecting the year(s), the UltraGrid cell will display with a yellow background to signify the range "1960 - 2006" is non-continious. The user also wants the dropdown to have a visual indication of which year(s) are un-selected. I suspect the best way to do this is to have two columns to display in the dropdown, one with the year, the other with 'isSelected' indication.
I have been able to make the cell contain a DropDownList which unfortunately contains only the years. (I do this by setting the column style to DropDownList - but this does not allow two columns to be displayed (ie a 'isSelected' status), and I have not been able to get a multi-select functionallity from the DropDownList.)
I am figuring the UltraDropDown can be used inside a WinGrid cell and can be used to display the year and its 'isSelected' status.
Can anyone show me a way set the column to display the UltraDropDown? I have studied the 'Per Cell ValueList and Editors' sample provided by IG.
Follow-up questions:
1. Is it possible to make the cell's control a multi-select ultraDropDown? - I do have a class possessing properties 'year' and 'isSelected'.
2. Any suggestions on how to retain the "1960 - 2006" display in the WinGrid cell, even when the user has selected / unselected years?
Gary
Gary,
There is no built-in capability for a multi-select dropdown in a WinGrid cell. Fortunately, there is a KB article on how to create one, though:
Multi-Select DropDown in WinGrid
As for what the cell's Value is and what the Text is, that is up to you to store. If you want to store the years selected as the Value of the cell, but still show a specific range of years, you could either override the ToString method of your bound object, assuming it is a custom class, or you could use a DataFilter to show whatever you want:
Data Filters
-Matt
The link for the article does not seem to work. Could you provide another link?
Those articles are obsolete, anyway. Unless you are using a very old version of the controls. Both UltraCombo and UltraComboEditor now have built-in support for multi-select.
These articles will show you how to set up multi-select for UltraComboEditor or UltraCombo:
https://ko.infragistics.com/help/winforms/wincomboeditor-selecting-multiple-values-within-wincomboeditor
https://ko.infragistics.com/help/winforms/wincombo-selecting-multiple-values-within-wincombo