Click here to Skip to main content
12,996,835 members (112,390 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 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 27-Nov-12 12:15pm
no, i have the drop down in the same column, how to do that
Mathlab 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2017
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