Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I hide one item in DropDownList when DataSourceID="SqlDataSource1"?

What I have tried:

I tried to do it:
C#
DropDownList1.Items.Remove(DropDownList1.Items.FindByText("Value"));

And this too:
C#
DropDownList1.Items[/*index*/].Enabled = false;

But they do not work.
Posted
Updated 27-Apr-18 0:42am

1 solution

This worked for me:

DropDownList1.Items.FindByText("Value").Enabled = false;


you can try this also:

DropDownList1.Items[/*index*/].Enabled = false;
 
Share this answer
 
v2
Comments
Member 13801130 27-Apr-18 7:02am    
Thanks, but it does not work for me
F-ES Sitecore 27-Apr-18 7:07am    
Then the problem is in the content of your code, ie what order you are doing things, the data that is in the control and so on. Those functions work and if they're not working for you is something about your implementation of the code which we can't see.

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