Click here to Skip to main content
11,804,008 members (78,794 online)
Rate this: bad
Please Sign up or sign in to vote.
Hi All,

I have a website, where in I can select the customer from a drop down list.

I would like to hide some of the customers name from being displayed in the drop down list as these customers have terminated services with us.

I wish to just hide the item to be displayed at run-time and not remove it.

Any idea ?? As i know how to remove but not sure to hide.

Appreciate for your feedback...

Posted 10-Sep-12 14:37pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you have a Flag in your Database table where customer information is stored , then you can filter the record which are active before binding it to Dropdown , else you can hide it using Linq
//a.Flag or (Your Filter criteria to identify the cusotmer is active or inactive

var customerList= GetCustomertList();  
customerList= customerList.Where(a => a.Flag != "Not Active or your interger value").ToList(); 

then bind the customerList to dropdown.
Nueman at 11-Sep-12 0:20am
Nicely done. Thanks.
Kuthuparakkal at 11-Sep-12 2:28am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


I agree with above solution,that you just only retrieve 'A' flag Customer before binding(if you added flag for customers),


select customer from cust_tbl where rec_status='A';

Otherwise you just remove it manually at runtime,i.e.


if there are multiple then just add it into LIST and remove listItem from dropdown same as above remove statement.

hope this will help you...

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

  Print Answers RSS
0 OriginalGriff 430
1 CPallini 320
2 Sergey Alexandrovich Kryukov 234
3 CHill60 230
4 Suvendu Shekhar Giri 200
0 OriginalGriff 3,000
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,755
4 Richard MacCutchan 1,187

Advertise | Privacy | Mobile
Web03 | 2.8.151002.1 | Last Updated 11 Sep 2012
Copyright © CodeProject, 1999-2015
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