Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
Hello guys, I have a gridview with dropdown lists in them. I want the selected value from the dropdownlist to not appear in the next dropdown list.
How can I go about this problem. Links to code and suggestions are most welcome.
Eg : Suppose I have a drop down list for Cities. If I select 'Mumbai' from the first drop down list then 'Mumbai' should not appear in the next drop down list.
Posted 27-Nov-12 3:25am
Mathlab at 27-Nov-12 9:33am
Make sure that your datasource has event and when the column changes do a validation on that column in your datasources update.
samrat399 at 27-Nov-12 12:15pm
no, i have the drop down in the same column, how to do that
Mathlab at 27-Nov-12 12:23pm
Are you using a datatable? If you are then datatables have events, specifically the column changed event, then you can llop through the values of the column to make sure that each one is unique.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you are using data tables then you can use the column changed event, if someone changes the dropdown in the data grid, it updates the data table.
You can do a for loop inside the event handler to check to see if the value is unique and change any values that are not unique.
Click the link for a list of datatable events and sample code:-[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Dnyaneshwar@Pune 604
1 OriginalGriff 394
2 thatraja 370
3 Sergey Alexandrovich Kryukov 329
4 CPallini 179
0 OriginalGriff 697
1 Dnyaneshwar@Pune 604
2 Kornfeld Eliyahu Peter 495
3 thatraja 370
4 Sergey Alexandrovich Kryukov 344

Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100