There are some built in methods for this.
DropDownList.Items.FindByValue()
DropDownList.Items.FindByText()
//sample.
DropDownList ddl = new DropDownList();
ListItem foundItem = ddl.Items.FindByValue( "ValueToLookFor" );
if ( foundItem != null )
{
//value was found!
}
bill
"Dave" <da*********@hotmail.com> wrote in message
news:eI**************@TK2MSFTNGP09.phx.gbl...
Hello.
I have DeropDownList control on my page and want to select some value by
SelectedValue, but before selecting I want to ensure that the value exists
in DeropDownList control's items.
How can I check it?
P.S. I must check only by value not by text.
Thank you.