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
17259
Value list for a unique value column
posted

Hi,

 I want to make a value list for a unique value column.

For example, if the user added one row with the value "1", and the value list contains "1", "2" and "3", in the next blank row I want the list to show only "2" and "3".

I used the BeforeCellListDropDown event to copy the value list items from the column and populate the cell value list with the values that don't show in any row.

The problem is that the list is not dropped down, probably because setting the value list cancels the event.

Here is the code I wrote in the BeforeCellListDropDown event:

ValueList columnList = e.Cell.Column.ValueList as ValueList;

ValueList cellList = DisplayLayout.ValueLists.Add();

foreach (var valueListItem in columnList.ValueListItems)

{

   bool valueFound = false;

   foreach (var row in Rows)

   {

      if (row.Index != e.Cell.Row.Index &&

         row.Cells[e.Cell.Column.Index].Value.Equals(valueListItem.DataValue))

      {

         valueFound = true;         

         break;

      }

   }

   if (!valueFound)

      cellList.ValueListItems.Add(valueListItem.DataValue, valueListItem.DisplayText);

}

e.Cell.ValueList = cellList;

Parents
No Data
Reply Children