Two properties of an object displayed in the Ultragrid are PartId and PartDescription.
One column in the UltraGrid is a dropdown containing a ValueList. It is composed of a collection of ValueListItems (dataValue(PartId) and displayText(PartDescription).
I attached the ValueList to the PartDescription column in the grid. The PartId column is hidden.
After making a selection from the dropdown at run-time, the underlying object has the PartDescription set to the dataValue of the ValueListItem. The PartId is null.
How can I correct this, so the DataValue property is assigned to PartId and the DisplayText property is assigned to PartDescription?
Hello Lars,
Thank you for posting in our forum.
If I understand you correctly you have a grid with two columns, PartId and PartDescription. You need to show the PartDescription of a particular object and when the user choose an object by PartDescription you need to retrieve the PartId of the chosen object. If this is your scenario you are on the right way with using ValueList. ValueList contains ValueListItems, which you need to populate in run time. Each ValueListItem has a DataValue and DisplayText. This way ValueList can translate ids into user-friendly text. What you need to do is to create only one column in your grid – Part Description column and assign your value list to this column. More about best practices for setting up a drop down in UltraGrid cell you may find by following the next link http://blogs.infragistics.com/winforms/wiki/best-practices-for-placing-a-dropdown-or-combo-in-an-wingrid-cell/2.aspx
Please check the attached sample solution implementing UltraGrid with ValueList and let me know if this is what you are looking for or if I am missing something.
Thanks for the help, Milko. It was especially helpful to see how you assigned both properties from the cell's Value and Text properties in your sample code.
However, if the user selects an item from the dropdown via keyboard control, not the mouse, I don't believe this event is triggered. In this case, the two properties do not get updated.
Is there any way around this?
I am just checking about the progress of this issue. Let me know if you need my further assistance on it.
Thank you for using Infragistics Components.
Yes, it appears that this event, AfterCellListCloseUp, does not fire if the user selects an item in the DropDown cell containting a ValueList via the keyboard, but it does when the mouse is used to select a ValueListItem.
What can I do to make it fire via the keyboard?
Thank you for your feedback.
AfterCellListCloseUp event occurs after a cell’s combo has been closed. This is the case when the user clicks with the mouse in the combo or if she navigate to the cell via the keyboard, clicks shift + down arrow and select value. More about AfterCellListCloseUp event you may find by following the next link http://help.infragistics.com/Help/Doc/WinForms/2015.1/CLR4.0/html/Infragistics4.Win.UltraWinGrid.v15.1~Infragistics.Win.UltraWinGrid.UltraGrid~AfterCellListCloseUp_EV.html Please note when after the combo has been closed only the text of the cell is changed. The value of the cell changes after the cell exits edit mode. This is why I am calling PerformAction method and force the cell to exit edit mode.
However if the user navigates with the keyboard and never drop down the cell’s combo this event will not fire. This is where you may use AfterCellUpdate event. When the user navigates with the keyboard, without dropping down the combo both value and text of the cell are changing.
Please try to explain what you are trying to achieve in your scenario and I will be happy to investigate this further for you.
The users of this software want to enter data in the grid without using the mouse. They are "power users". For them to have to use the mouse to ensure that the combo/grid is operating "correctly" slows them down.
The combo is the first column in the grid. After selecting the desired row within the combo, I need to check that the selected value does not exist in any other row within the grid. If it does, I need to tell the user and not allow the row to be created with this value.
Further, the last row is a decimal datatype. I use the selected value of the combo box to lookup the most current unit cost paid for this item in table other than the primary one on which this grid is based.
Thanks for your help.
We are still following this forum thread.
Please feel free to let us know if you still have any questions on this matter.