Accessing a drop down in a form view from a user control

L

Larry Bud

Main page has a FormView, and within that, is a drop down.

A user control is on the page
From the user control, I need access to the drop down value. I can get
to it like this

Dim cc As FormView, dd As DropDownList

cc = Parent.FindControl("FormView1")
dd = cc.FindControl("currency_code")

exchange_rate.Text = dd.SelectedValue

Is there a more direct route?
 
M

Mark Rae

Main page has a FormView, and within that, is a drop down.

A user control is on the page

to it like this

Dim cc As FormView, dd As DropDownList

cc = Parent.FindControl("FormView1")
dd = cc.FindControl("currency_code")

exchange_rate.Text = dd.SelectedValue

Is there a more direct route?

Have you tried

exchange_rate.Text = currency_code.SelectedValue

?
 
M

Mark Rae

Yes, I have. Compilation error, "currency_code not declared."

OK then - have you tried prefixing currency_code.SelectedValue with the id
of the custom control...?
 

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,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top