Click here to Skip to main content
12,451,860 members (24,433 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET VS2010
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 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
 
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
Top Experts
Last 24hrsThis month


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