formview field info lookup

Roberto Madro R.
Roberto Madro R. used Ask the Experts™
I got an web form with formview bound a database table (Table1), however on this form I have 2 fields that should be getting their information (via drop_down_list somehow) from Table2 and at the end (once the form is filled out) save all the data to Table1, please advise on best approach.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Here is an example.

In this example the datasource for the FormView is DSTable1  and the EmployeeID from DSTable1 is bound to the DropDownList SelectedValue.  The DropDownList is getting the list of employees from the DataSource dsEmployees.
<asp:FormView ID="FormView1" runat="server" DataKeyNames="ID" DataSourceID="DSTable1" DefaultMode="Insert" >
        <asp:DropDownList ID="ddlEmployee" runat="server" DataSourceID="dsEmployees" DataTextField="empName"
            DataValueField="EmployeeID" SelectedValue='<%# Bind("EmployeeID") %>'>
        <asp:SqlDataSource ID="dsEmployees" runat="server" ConnectionString="<%$ ConnectionStrings:PsiConnectionString %>"
            SelectCommand="SELECT EmployeeID, FirstName + ' ' + LastName AS empName FROM jtEmployees WHERE Active=1 ORDER BY FirstName">
        <asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial