Hey All ...
Problem/Setup:
I have an UltraGrid that is bound to an UltraDataSource to get data. I need to define a ValueList (limit to list) at the Cell Level. The values in the ValueList are not dependant on any other column value. The values in the ValueList are going to be defined by a value in the underylying data. I cannot populate the value based on CellUpdate or CellChange, because its not based on any values in the grid.
How do I dynamically put a different ValueList in a cell when I programmatically change a value on the underlying entity?
I could trap the Grid.InitializeRow event to check the underlying entity to determine what values go in the ValueList. That covers the initial creation. But, if a user changes any value on that row, to a different value ... that could possibly trigger a new ValueList to be generated. I would need to trap the AfterCellUpdate for every single Cell to basically create a new ValueList and attach it to the correct Cell (for that Row).
Ideally, it would be best to trap it at the UltraDataSource.CellDataRequested level (Last possible moment), Get The ValueList, attach it to the Cell, and then allow the CellDataRequested Event to continue - in that fashion, the Cell's ValueList would be present before the Cell get's its Actual Value. I could manipulate the CacheData variable on the UltraDataSource to trigger the CellDataRequested for ValueList Changes. Unfortunately, I don't think that is possible ... right?
Unless there is another "Hook" I could tap into that happens just before the CellDataRequested event fires?
Hi Mark,
Thank you for posting in our forums!
The ValueList object assigned on Column or Cell level, can’t be bound to underlying data source. For further reference please read the following knowledge base article - http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7841
Instead you have to use UltraDropDown that will be bound to underlying data source using the same approach as the grid itself and then assigned to the ValueList object on Column or Cell level.
As a result, you will accomplish two – way binding to the underlying data source and any UI interaction or programmatically data source change will be automatically synchronized between each other.
Please let me know if you need any further assistance on this matter.
Ivaylo Petrov said: The ValueList object assigned on Column or Cell level, can’t be bound to underlying data source. For further reference please read the following knowledge base article - http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7841
Correct, I am aware you cannot bind the ValueList to the underlying Data source. I will look into the UltraDropDown approach and see if that will work. Thanks.
I will be waiting for your feedback.
Thank you for using Infragistics Components!
Hiya,
Did some testing and this is what I found out.
If I attach a ValueList to a Column, while still keeping a reference to that ValueList in another area of code ....
I can change the ValueList.ValueListItems collection and the changes will immediately be reflected by the grid cell, without a grid refresh or using a Grid Event.
As far as I understand all cells under that independent column will be with the same value list items. In this case setting one value list on column level is the most rational way of populating all those cells.
Indeed keeping a reference of the value list collection and update it whenever it is requested is possible workaround in your scenario.