I would like to set the selected item of drop downbox to the index of an
item that will only be known at run time.
I realise that if I were to know it at design time I could write
ddlResidentialCity.SelectedIndex = 3
however what I wish to do is say
ddlResidentialCity.SelectedIndex = Set to value of item who's text value is
"martin"
what I am unsure about is how to get the index of the item I wish to use as
the selected index
any help would be appreciated.
cheers
martinH
ddlResidentalCity.Items.FindByValue("martin").Selected = True
How about this?
ddlResidentialCity.SelectedValue = "martin"
"martin" <Stuart_REMOVE_36@.yahoo.com> wrote in message news:<#N9fYmwQEHA.132@.TK2MSFTNGP09.phx.gbl>...
> Hi,
> I would like to set the selected item of drop downbox to the index of an
> item that will only be known at run time.
> I realise that if I were to know it at design time I could write
> ddlResidentialCity.SelectedIndex = 3
> however what I wish to do is say
> ddlResidentialCity.SelectedIndex = Set to value of item who's text value is
> "martin"
> what I am unsure about is how to get the index of the item I wish to use as
> the selected index
>
> any help would be appreciated.
> cheers
> martin
0 comments:
Post a Comment