Saturday, March 24, 2012

Dropdownlist with non-selectable items

Hi all,

I've been using AJAX and the Toolkit. I don't know much about authoring my own controls, so I'll need a lot of help here. Basically what I want is a dropdownlist where some of the items in the list are non-selectable. I can then use the non-selectable items to group selectable items together. For example:

Imagine the following items in a Dropdownlist:

-- Fruit --

Apple

Orange

Banana

-- Vegetables --

Carrot

Onion

Garlic

I want the items "Fruit" and "Vegetables" should be non-selectable. I could always do this with two cascading dropdown lists but this is a more user-friendly solution (less controls, less clicks, etc). It was also requested by my clients.

You can check ,

DropDownList.SelectedIndex property for perticauler position value.

If it is --Fruit-- or --Vegetables-- try to re-set index of dropdownlist.


I suggested that to the clients butthey want these items to be static - i.e. don't even give the user the chance to select them.

In other words, when you hover your mouse over --Fruit-- or --Vegetable-- ListItems, theyshouldn'tbe highlighted or selectable at all. If the user tries to click on one of them, the DropDownList should just continue to be expanded as if nothing happened.

No comments:

Post a Comment