In ASP.NET 2.0 List by setting Enabled=’False’ to the individual list item, entries avoids it from being displayed but it remains in the collection.
It can be coded as below.
<asp:ListBox ID='ListBox1' runat='server' >
<asp:ListItem Enabled='False'>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
<asp:ListItem>Item 6</asp:ListItem>
</asp:ListBox>
Here Item1 remains in the collection but will not be displayed.
Share with