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
martinHi
ddlResidentalCity.Items.FindByValue("martin").Selected = True
ddlResidentialCity.SelectedIndex = ddlResidentalCity.Items.IndexOf( ddlResid
entalCity.Items.FindByText("martin"))
How about this?
ddlResidentialCity.SelectedValue = "martin"
"martin" <Stuart_REMOVE_36@.yahoo.com> wrote in message news:<#N9fYmwQEHA.132@.TK2MSFTNGP09.p
hx.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 i
s
> "martin"
> what I am unsure about is how to get the index of the item I wish to use a
s
> the selected index
>
> any help would be appreciated.
> cheers
> martin
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment