Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
How to deal with outdated values in a valuelist?
posted
I'm using a valuelist in the Wingrid, but the problem I'm running into is that some of the values from the list are outdated.
 
Is there a way to limit the values in a list, but for already-assigned values in the grid, leave those alone?
 
For example, let's say I have a list of employees:
 
EmployeeId     Name
1                     Bob
2                     Mary
3                     John
 
My valuelist would be
1  Bob
2  Mary
3  John
 
And in my grid, assuming I chose those names, it would display as:
Bob
Mary
John
 
But let's say John left the company. I no longer want to display John as a chooseable value in the dropdown, but I DO want to keep his name in places where it has been assigned in the past.
 
How can I achieve that?
 
Thanks


Parents
  • 469350
    Verified Answer
    Offline posted

    Hi,

        There's no great way to handle with this with a regular ValueList. But you can do it with an UltraDropDown control as your ValueList. In fact, I did this myself for an application I wrote years ago. 

        What you do is replace your ValueList with an UltraDropDown control. Set the ValueMember and DisplayMember to the EmployeeId and Name fields respectively. The UltraDropDown can display multiple columns. In this case, you really only want to display one, so you would hide all but the Name column, but the presence of multple column is significant because it allows you to have an additional field on the list like "Active". Then what you do is handle the InitializeRow event of the UltraDropDown and examine the cell value of the "Active" field and if the person is no longer active, set the Hidden property on the row. This hides the rows from the user, but the editor can still use it to translate the ID to the Name. 

Reply Children