Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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.
 
Share this answer
 
Comments
Nueman 11-Sep-12 0:20am    
Nicely done. Thanks.
Kuthuparakkal 11-Sep-12 2:28am    
5+
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.

SQL
select customer from cust_tbl where rec_status='A';


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

C#
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...
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900