I have a webdropdown which uses a template webdatagrid for its content.
Rhe webdropdown uses a uniqueidentifier as the value, and a Name as the Display property. The OnValueChanged event then updates another grid and other labels and textboxes based on the RECNUM (value) of this dropdown.
The webdatagrid has the columns RECNUM, NAME, DATE, DETAILS .....
In the datasource for the dropdown's grid, the NAME column is often replicated. There is a concatinated unique index on the NAME, DATE columns and the primary key is the RECNUM (unique identifier).
A sample of my test data is as follows:
1 Item Name A 01/01/2011 Data Column for 1 2 Item Name B 02/01/2011 Data Column for 2 3 Item Name C 03/01/2011 Data Column for 3 4 Item Name D 04/01/2011 Data Column for 4 5 Item Name E 05/01/2011 Data Column for 5 6 Item Name E 06/01/2011 Data Column for 6 7 Item Name F 03/01/2011 Data Column for 7 8 Item Name G 04/01/2011 Data Column for 8 9 Item Name H 10/12/2010 Data Column for 9 10 Item Name I 11/12/2010 Data Column for 10 11 Item Name J 12/12/2010 Data Column for 11 12 Item Name K 13/12/2010 Data Column for 12 13 Item Name K 14/12/2010 Data Column for 13 14 Item Name L 15/12/2010 Data Column for 14 15 Item Name M 16/12/2010 Data Column for 15 16 Item Name N 17/12/2010 Data Column for 16
If you notice that no 5 and 6 have the same NAME, as does 12 & 13.
My problem: When I first select an item in the dropdown which has a NAME that is duplicated, it will display correctly, however, when I select the 2nd item with the same NAME (but different RECNUM and DATE), it does not trigger the OnValueChanged event.
If you select item 5, it will display all information below correctly. If you then select item 6, it does not. However if you select item 9 (for example), and then item 6, the details for item 6 will display correctly. If you then select Item 5, it will not.
It is as though the ValueChanged event is using the display text (NAME) as the value instead of the specified value column, which is RECNUM.
How do I get this to work?
Hello lorettac242 ,
Thank you for posting in our forum.
Thnak you for the sample. This is an expected behavior since the drop down doesn’t hold any actual regard to the selected row in the grid. This line :
dd.set_currentValue(row, true);
just manually sets the string value for the input element. When the same text is set the grid doesn’t detect a change in that value and therefore the ValueChanged event will not get fired. Keep in mind that in this scenario there is only one actual drop down item which has no value or text set. Instead it contains a template with a grid and the changes you apply to the web drop down are all manual.
What you can do is handle the RowSelectionChanged event of the grid. It will fire even when the items have the same names. You can just move the logic from the drop downs ValueChanged event to RowSelectionChanged event and it will work as you expect.
Please refer to the attached sample and let me know if you have any questions or concerns.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://ko.infragistics.com/support