Extended DropDownList Select Item Progammatically

Dec 11, 2008 at 5:52 AM
I'm having trouble selecting an item programtically using the ExtendedDropDownList control.  For a normal dropdownlist control you would use the following code:
ddl.items.FindByValue("1").selected = true;

I see the ExtendedDropDownList has ExtendedItems, however the FindByText and FindByValue methods are not to be found. Are their any known work arounds for this?

Thank you! Easton
Coordinator
Dec 11, 2008 at 7:16 AM
Easton, the same code as the one you posted for the DropDownList should also work with ExtendedDropDownList...
Dec 11, 2008 at 7:32 AM
Ra001,

Thank you for your quick reply! The intellisense of the entendeddropdownlist control doesn't seem to have an 'Items' available to consume. Am i smoking crack? And I cannot find the FindByText or FindByValue methods anywhere. I'm using the latest release.
Coordinator
Dec 11, 2008 at 4:39 PM
Easton,

I tried the following code on the demos: 
this.ddl.Items.FindByValue("23").Selected = true;
and worked as expected.

Perhaps the reason you don't have the Items collection in the autocomplete is we override the property and add it the following attributes:

[Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

Enjoy!
Raul 
Dec 11, 2008 at 4:52 PM
Ah, yes. That works great! I'm not sure why it's set to not be browsable, but it compiles and executes just fine. Thank you very much for your help an insight.

This is a great project, keep up the good work!

- Easton