Click here to Skip to main content
15,888,733 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have one DropDownList.
HTML
<asp:DropDownList Width="150px" ID="ddl_type" runat="server" AppendDataBoundItems="true">
  <asp:ListItem Value="0">Select Type<</asp:ListItem>
  <asp:ListItem Value="1" Enabled="false">A</asp:ListItem>
  <asp:ListItem Value="2" Enabled="false">B</asp:ListItem>
  <asp:ListItem Value="3">C</asp:ListItem>
  <asp:ListItem Value="4">D</asp:ListItem>
 </asp:DropDownList>

and in this DropDownList tow ListItem enable are false and my problem is how to enable true in this tow ListItem.

Thanks
Posted
Updated 31-Jul-13 19:23pm
v3
Comments
Maarten Kools 31-Jul-13 10:45am    
foreach (ListItem item in ddl_type.Items.Cast<ListItem>().Where(i => !i.Enabled))
item.Enabled = true;

You mean like that?

1 solution

C#
ddl_type.Items[1].Enabled = true;
           ddl_type.Items[2].Enabled = true;
 
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