Does anyone know if it is possible (via the designer) to define a single column within the Ultragrid,
so that each of it's cell rows has a Ultradropdown, with a predefined list of choices you have setup
within the designer? e.g. dropdown contains list items "Yes", "No" they can select... with a default
value that is set.
Hi,
Yes, of course this is possible. Which part of it is giving you trouble?
A basic overview of how to do this is something like this:
Drop a grid on a form and use the designer to create a data source (or bind to a data source) with a single column.
Then you need to create the dropdown. You could do this with a ValueList or an UltraDropDown. HOWTO:What is the best way to place a DropDown list in a grid cell?
You attach the dropdown to the column using the ValueList property on the column.
Mike,
Thank you for your quick reply!
The HOWTO link you inserted is broke.
The part that is giving me trouble... is that I have a dropdown ctrl
added to the ultragrid, and have the ValueList property set to that
dropdown but no dropdown is displayed within the cell. I have not
added any values to the dropdown yet... so am assuming that might
be the issue?
kerwinkassulker said:The HOWTO link you inserted is broke.
Actually, the link is working, but it might not work if you are using the latest version of IE. Try running IE in compatibility mode and it should work. I will repost the text of the article below, just in case.
kerwinkassulker said: I have not added any values to the dropdown yet... so am assuming that might be the issue?
I have not
Yes, that could certainly be a problem. Are you seeing the dropdown arrow in the cell at all? If no arrow shows up, then my next guess is that the grid cell does not allow editing.
Thank you for following up.
No, I cannot change the cell by typing... i.e. and that has left me suspicious something is wrong.
Thank you for the suggestions on what to try... I might need to follow up on this next week.
Can you change the cell value by typing? If not, then the cell is read-only and that's why you cannot see the dropdown. Cells in the grid are editable by default. So you do not need to set any properties to make them editable. So if the cell is not editable, then there are two possibilities.
1) Something in your code is setting a property which disallows editing on that cell (maybe this is happening after the two property settings you have here).
2) You data source does not allow editing (in which case no property setting on the grid can possibly have any effect).
No, do not see any dropdown arrow in the cell.
I have the following column props set:
CellActivation = AllowEdit
CellClickAction = Edit
It is often desirable to place a dropdown list of choices in a cell of the grid. This has several advantages: 1) The user can drop down a list and pick one of several options.2) The dropdown list can act as a lookup table to convert ID values into more user-friendly display text.3) The dropdpown list can limit the user to a specific set of choices without permitting entry of invalid values.
There are several different ways to attach a list of values to a grid column. The simplest of these is the ValueList property of the Column. The ValueList property of a column or cell can accept any object which implements the IValueList interface, such as a ValueList object or an UltraDropDown control. The UltraCombo control also implements IValueList, but it is generally desirable to use UltraDropDown instead of UltraCombo, because it has less overhead. ValueListThe ValueList is a very simple, light, and easy-to-use object. You can create a ValueList by using the ValueLists collection on the grid's DisplayLayout. Each ValueListItem has a DataValue and a DisplayText, so the ValueList can translate ID's into user-friendly text. The ValueList displays only a single column of values with no column header, much like the Microsoft ComboBox. ValueLists cannot be bound, they must be populated manually either at design-time or run-time. ValueList in VB:
ValueList in C#:
UltraDropDownUltraDropdown is a much more powerful ValueList. It is essentially a dropdown UltraWinGrid (although it is limited to a single band). Just like the WinGrid, it must be bound and has a wide range of Appearances and features such as sorting, filtering and resizable columns. It can display multiple columns, just like the WinGrid. To translate ID's into user-friendly text, set the ValueMember and DisplayMember properties which detmermine the ID and text columns respectively. UltraDropDown in VB:
UltraDropDown in C#:
UltraComboThe UltraCombo can be used as a ValueList and it has essentially the same features as UltraDropDown. However, UltraCombo is intended for use as a standalone ComboBox. So while it can be used as a ValueList, there is no reason to do so. It has no advantage over UltraDropDown and has greater overhead. In addition to being an IValueList, the UltraCombo is also an Editor. So it can also be assigned as the EditorControl of a column. This has certain advantages over the UltraDropDown, such as the ability to use a DataFilter or provide EditorButtons. But if you are not using these features, the extra overhead of UltraCombo means that the UltraDropDown is a better choice.DropDownStyleBy default, when a ValueList is attached to a grid column, the user may choose an item from the list or may type into the cell. The grid will attempt to find the closest matching item on the list and fill in the cell (AutoComplete). If no match is found, the user may enter text that does not exist on the list. To prevent this, set the DropDownStyle property of the grid column to DropDownList. This will prevent the user from typing into the cell, although the keyboard will still function for searching through the list.