populate FormView fields from a DropDownList

M

mkidd

Hi,

I'm trying to build an online form using asp.net and vb.net for the
code behind in Visual Studio 2005.

I want to fill 3 fields in a FormView that's connected to one table
(table1) with information from another table (table2) by choosing the
key field from table2 in a DropDownList.

Table2 has 3 fields with info that doesn't change (name, phone# and
email for about 5 customer service reps). I want each rep to choose
their name in the DropDownList to populate those fields in the
FormView.

I'm connecting to the sql db with an ObjectDataSource.

I'm thinking I just need to put some VB code into the
SelectedIndexChanged event of the ddl, something like:

*something goes here* = DropDownList1.SelectedValue.ToString()

But I'm drawing a blank on what would go to the left of the equal
sign.

Thanks in advance for the help.
 
E

Eliyahu Goldin

myFormView.FindControl("myControlId") will find the control if it is in the
template the formview is going to present. Otherwise you may need to do
something like myFormView.EditItemTemplate.FindControl("myControlId").

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
M

mkidd

Thanks, but can you help me with what to do to write the data from the
DropDownList table to the FormView after the FindControl event? I'm
really new at this.

myFormView.FindControl("myControlId") will find the control if it is in the
template the formview is going to present. Otherwise you may need to do
something like myFormView.EditItemTemplate.FindControl("myControlId").

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net


I'm trying to build an online form using asp.net and vb.net for the
code behind in Visual Studio 2005.
I want to fill 3 fields in a FormView that's connected to one table
(table1) with information from another table (table2) by choosing the
key field from table2 in a DropDownList.
Table2 has 3 fields with info that doesn't change (name, phone# and
email for about 5 customer service reps). I want each rep to choose
their name in the DropDownList to populate those fields in the
FormView.
I'm connecting to the sql db with an ObjectDataSource.
I'm thinking I just need to put some VB code into the
SelectedIndexChanged event of the ddl, something like:
*something goes here* = DropDownList1.SelectedValue.ToString()
But I'm drawing a blank on what would go to the left of the equal
sign.
Thanks in advance for the help.
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top