DropDown Selected Item Default

  • Thread starter Thread starter Thom Little
  • Start date Start date
T

Thom Little

I have a simple dropdown list with four elements. Element 0 is defined as
"Selected True".

I would like to pass this function a string and compare the string against
the Item Text field. When there is a match I want to mark that item as
"Selected True" to in essence set a new default value.
 
Got it ... it is ...

if ( Request.QueryString["product"] != null )
foreach ( ListItem li in ddlProduct.Items )
if ( li.Text == Request.QueryString["product"].ToString( ) )
li.Selected = true ;
 
Back
Top