Click here to Skip to main content
Rate this: bad
good
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
Comments
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
good
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:-
 
http://msdn.microsoft.com/en-us/library/9hx67se8(v=vs.100).aspx[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 365
1 _Amy 265
2 Richard Deeming 250
3 Nirav Prabtani 248
4 CHill60 195
0 _Amy 110
1 Maciej Los 90
2 OriginalGriff 85
3 Mehdi Gholam 80
4 Sergey Alexandrovich Kryukov 75


Advertise | Privacy | Mobile
Web02 | 2.8.140721.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