dropdownlist FindByText

G

Guest

hey all,
drp1.SelectedValue = drp1.Items.FindByText(lblEdit.Text)

how would i make the above work. it says:

Cannot implicitly convert type 'System.Web.UI.WebControls.ListItem' to
'string'

thanks,
rodchar
 
M

Mark Rae [MVP]

drp1.SelectedValue = drp1.Items.FindByText(lblEdit.Text)

drp1.Items.FindByText(lblEdit.Text).Selected = True

Not particularly robust, though, as this will throw an exception if the item
in question can't be found...
 
G

Guest

thanks for the help.
rod.

Mark Rae said:
drp1.Items.FindByText(lblEdit.Text).Selected = True

Not particularly robust, though, as this will throw an exception if the item
in question can't be found...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top