Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Design VS2010
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...
 
Regards,
Janavi
Posted 10-Sep-12 15:37pm
Rate this: bad
good
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.
  Permalink  
Comments
Nueman at 11-Sep-12 0:20am
   
Nicely done. Thanks.
Kuthuparakkal at 11-Sep-12 2:28am
   
5+
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 

 
I agree with above solution,that you just only retrieve 'A' flag Customer before binding(if you added flag for customers),
i.e.
 
e.g.
 
select customer from cust_tbl where rec_status='A';
 
Otherwise you just remove it manually at runtime,i.e.
 
ddlcustomer.Items.Remove("Customer_id");
 
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...
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 8,478
1 OriginalGriff 6,516
2 Peter Leow 3,587
3 Zoltán Zörgő 3,406
4 Richard MacCutchan 2,397


Advertise | Privacy | Mobile
Web03 | 2.8.150123.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