Thursday 18 October 2012

Hiding Item in Dropdownlist


Hiding Item in Dropdownlist

We sometime came across scenarios when we are required to remove an item from multiple items inside dropdownlist control. We can use remove and removeat  method of dropdownlist to achieve this goal.

Have a look how to achieve this:


        for (int i = 0; i < DropDownList1.Items.Count; i++)
        {
            if (DropDownList1.Items[i].Selected)
            {
                DropDownList1.Items.Remove(DropDownList1.Items[i]);
            }
        }

No comments:

Post a Comment

Thank You for Your Comments. We will get back to you soon.

back to top