I have two drop downs (the 1st pulls from 1 db table then populates the second which pulls from a 2nd db table) with the idea of having them both populate fields of a form on autopostback. The user will then fill out the remaining empty fields.

I have not been able to get anywhere with populating the form text boxes as I'm not yet too proficient asp.net/vb realm.

Any help is greatly appreciated.

If I understood your question correctly, the following steps should give you what you want.

1) Set AutoPostBack=True for the dropdownlists
2) Create an event that sets the form field's value to the selected value or text of the dropdownlist.

Here's a quick example.

ASPX

<asp:DropDownList ID="ddl" runat="server" AutoPostBack="true">
<asp:ListItem Text="Select" Value=""></asp:ListItem>
<asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txt" runat="server">

Code-Behind

Protected Sub ddl_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddl.SelectedIndexChanged
  txt.Text = ddl.SelectedValue
End Sub

I'm assuming that instead of just assigning the dropdownlist's SelectedValue to the textbox's text property, you'll use the SelectedValue to calculate a new value or run a through a stored procedure to get a new value, but I may be wrong.

Good luck!

Thanks for the response. I've attached a visual of what I'm trying to do. Some of the info posted in the text boxes will be pulled from the correct tables in database and some will be exactly what was selected in the drop downs. Here is my current code.

aspx

<span class="style5">Select a Company:</span>
                                                        <asp:DropDownList 
                                                            ID="DropDownList1" 
                                                            runat="server" 
                                                            DataSourceID="SqlDataSource1" 
                                                            DataTextField="Company" 
                                                            DataValueField="cusID" 
                                                            CssClass="maintext" 
                                                            ForeColor="Maroon" AutoPostBack="True" AppendDataBoundItems="True">
                                                            <asp:ListItem Value="">Select One</asp:ListItem>
                                                        </asp:DropDownList>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td
                                                        <span class="maintext"><b>Select a Contact:</b> &nbsp;</span>&nbsp;
                                                        <asp:DropDownList 
                                                            ID="DropDownList2" 
                                                            runat="server" 
                                                            DataSourceID="SqlDataSource2" 
                                                            DataTextField="contID" 
                                                            DataValueField="contactID" 
                                                            CssClass="maintext" 
                                                            ForeColor="Maroon" AutoPostBack="True" AppendDataBoundItems="True">
                                                            <asp:ListItem Value="">Select One</asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:Label ID="labelSelection" 
            runat="server" style="z-index: 102; left: 368px; position: absolute; top: 144px">
        </asp:Label>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="style6">
                                                        <asp:HyperLink 
                                                            ID="AddCompany" 
                                                            runat="server" 
                                                            CssClass="maintext" 
                                                            Font-Bold="True" 
                                                            ForeColor="Maroon" 
                                                            NavigateUrl="~/ServiceExpress/DisAddCo.aspx">Add New Company?</asp:HyperLink>
                                                        <br />
                                                        <br />
                                                        <asp:FormView ID="FormView1" runat="server" DefaultMode="Insert">
                                                            <InsertItemTemplate>
                                                                <table cellpadding="0" 
    class="style2">
                                                                    <tr>
                                                                        <td class="maintext">
                                                                            Company:</td>
                                                                        <td colspan="5" style="margin-left: 40px">
                                                                            <asp:TextBox ID="Company" runat="server" Width="250px" ReadOnly="True"></asp:TextBox>
                                                                        </td>
                                                                        <td class="maintext">
                                                                            Phone:</td>
                                                                        <td>
                                                                            <asp:TextBox ID="Phone" runat="server" ReadOnly="True"></asp:TextBox>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="maintext">
                                                                            First Name:</td>
                                                                        <td colspan="5">
                                                                            <asp:TextBox ID="FirstName" runat="server" Width="200px" ReadOnly="True"></asp:TextBox>
                                                                        </td>
                                                                        <td class="style10">
                                                                            &nbsp;</td>
                                                                        <td>
                                                                            &nbsp;</td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="maintext">
                                                                            Last Name:
                                                                        </td>
                                                                        <td colspan="5">
                                                                            <asp:TextBox ID="LastName" runat="server" style="margin-bottom: 0px" 
                                                                                Width="200px" ReadOnly="True"></asp:TextBox>
                                                                        </td>
                                                                        <td class="maintext">
                                                                            Technician:</td>
                                                                        <td>
                                                                            <asp:DropDownList ID="DropDownListTech" runat="server" CssClass="maintext" 
                                                                        DataSourceID="SqlDataSource3" DataTextField="techid" 
                                                                        DataValueField="UserID" AppendDataBoundItems="True">
                                                                        <asp:ListItem Value="">Unassigned</asp:ListItem>
                                                                         </asp:DropDownList>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="maintext">
                                                                            Address:</td>
                                                                        <td colspan="5">
                                                                            <asp:TextBox ID="Address1" runat="server" Width="200px" ReadOnly="True"></asp:TextBox>
                                                                        </td>
                                                                        <td class="maintext">
                                                                            Priority:</td>
                                                                        <td>
                                                                            <asp:DropDownList ID="DropDownListPriority" runat="server" CssClass="maintext">
                                                                                <asp:ListItem Selected="True">Select One</asp:ListItem>
                                                                                <asp:ListItem>Red (High)</asp:ListItem>
                                                                                <asp:ListItem>Yellow</asp:ListItem>
                                                                                <asp:ListItem>Blue</asp:ListItem>
                                                                                <asp:ListItem>Green (Low)</asp:ListItem>
                                                                            </asp:DropDownList>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="style15">
                                                                            &nbsp;</td>
                                                                        <td colspan="5">
                                                                            <asp:TextBox ID="Address2" runat="server" Width="200px" 
                                                                                style="margin-bottom: 0px" ReadOnly="True"></asp:TextBox>
                                                                        </td>
                                                                        <td class="maintext">
                                                                            Billing:</td>
                                                                        <td>
                                                                            <asp:DropDownList ID="DropDownListBill" runat="server" CssClass="maintext">
                                                                                <asp:ListItem Selected="True">Select One</asp:ListItem>
                                                                                <asp:ListItem>Contract</asp:ListItem>
                                                                                <asp:ListItem>Time/Materials</asp:ListItem>
                                                                            </asp:DropDownList>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="maintext">
                                                                            City:</td>
                                                                        <td class="style14">
                                                                            <asp:TextBox ID="City" runat="server" ReadOnly="True"></asp:TextBox>
                                                                        </td>
                                                                        <td class="maintext">
                                                                            State:</td>
                                                                        <td class="style12">
                                                                            <asp:TextBox ID="State" runat="server" Width="30px" ReadOnly="True"></asp:TextBox>
                                                                        </td>
                                                                        <td class="maintext">
                                                                            Zip:</td>
                                                                        <td class="style11">
                                                                            <asp:TextBox ID="Zip" runat="server" Width="80px" ReadOnly="True"></asp:TextBox>
                                                                        </td>
                                                                        <td class="style10">
                                                                            &nbsp;</td>
                                                                        <td>
                                                                            &nbsp;</td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="style15">
                                                                            &nbsp;</td>
                                                                        <td class="style14">
                                                                            &nbsp;</td>
                                                                        <td class="style13">
                                                                            &nbsp;</td>
                                                                        <td class="style12">
                                                                            &nbsp;</td>
                                                                        <td class="style9">
                                                                            &nbsp;</td>
                                                                        <td class="style11">
                                                                            &nbsp;</td>
                                                                        <td class="style10">
                                                                            &nbsp;</td>
                                                                        <td>
                                                                            &nbsp;</td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="maintext">
                                                                            Equipment:</td>
                                                                        <td class="style14">
                                                                            <asp:DropDownList ID="DropDownListEquip" runat="server" CssClass="maintext">
                                                                            </asp:DropDownList>
                                                                        </td>
                                                                        <td class="style13">
                                                                            &nbsp;</td>
                                                                        <td class="style12">
                                                                            &nbsp;</td>
                                                                        <td class="style9">
                                                                            &nbsp;</td>
                                                                        <td class="style11">
                                                                            &nbsp;</td>
                                                                        <td class="style10">
                                                                            &nbsp;</td>
                                                                        <td>
                                                                            &nbsp;</td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="maintext" valign="top">
                                                                            Problem:</td>
                                                                        <td class="style8" colspan="5">
                                                                            <asp:TextBox ID="Problem" runat="server" Height="100px" TextMode="MultiLine" 
                                                                        Width="400px"></asp:TextBox>
                                                                        </td>
                                                                        <td class="maintext" valign="top">
                                                                            Notes:</td>
                                                                        <td>
                                                                            <asp:TextBox ID="Notes" runat="server" Height="100px" TextMode="MultiLine" 
                                                                        Width="400px"></asp:TextBox>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="style7" colspan="8" valign="top">
                                                                            <asp:Button ID="Button1" runat="server" Text="Submit" />
                                                                            &nbsp;<asp:Button ID="Button2" runat="server" Text="Reset" />
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </InsertItemTemplate>
                                                        </asp:FormView>

Code behind

Partial Class AddCall
    Inherits System.Web.UI.Page
    Protected Sub DropDownList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        labelSelection.Text = DropDownList1.SelectedItem.Text & " " & DropDownList2.SelectedItem.Text

    End Sub

End Class
Attachments dropdown.gif 10.95 KB

Oh I see. So what is it that you're currently unsure of? How to query your database with the selected value from the drop down list? Just let us know.

Jake

Yes, I am not sure how that would be done with two drop downs from two different tables. I've found plenty about one drop down populating something, but not this.

Sure. Here's some code to get you started. You'll want to do this in the SelectedIndexChanged event handler for both dropdowns (changing the appropriate parts of the code). You'll need to change anything prefixed with "your_" to match your settings.

Dim str_sql As String = "SELECT * FROM your_table WHERE cusID = " & DropDownList1.SelectedValue
        Using connection As New System.Data.SqlClient.SqlConnection("your_connection_string")
            Dim command As New System.Data.SqlClient.SqlCommand(str_sql, connection)
            connection.Open()
            Dim reader As System.Data.SqlClient.SqlDataReader = command.ExecuteReader()
            Try
                If reader.Read Then
                    Address1.Text = reader.Item("your_column_name").ToString
                End If
            Finally
                ' Always call Close when done reading.
                reader.Close()
            End Try
        End Using

Ok, I'm not exactly sure what you mean by "do this in the SelectedIndexChanged event hander."

Nothing happens with this in my code behind:

Partial Class AddCall
    Inherits System.Web.UI.Page
    Protected Sub DropDownList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        labelSelection.Text = DropDownList1.SelectedItem.Text & " " & DropDownList2.SelectedItem.Text

        Dim Address1 As TextBox = TryCast(FormView1.FindControl("Address1"), TextBox)

        Dim str_sql As String = "SELECT * FROM Customers WHERE cusID = " & DropDownList1.SelectedValue
        Using connection As New System.Data.SqlClient.SqlConnection("HRIServiceConnectionString1")
            Dim command As New System.Data.SqlClient.SqlCommand(str_sql, connection)
            connection.Open()
            Dim reader As System.Data.SqlClient.SqlDataReader = command.ExecuteReader()
            Try
                If reader.Read Then
                    Address1.Text = reader.Item("Address1").ToString
                End If
            Finally
                ' Always call Close when done reading.
                reader.Close()
            End Try
        End Using

    End Sub

End Class

Try changing

DropDownList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

to

DropDownList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList2.SelectedIndexChanged

Holy crap its almost working!!!! Its posting the name and contact randomly above the drop downs as well as in the text boxes. How do I get rid of the the ones above?

Lol. :) I'm glad you're getting close!

I'm not 100% sure what you mean, but you may want to try removing this line.

labelSelection.Text = DropDownList1.SelectedItem.Text & " " & DropDownList2.SelectedItem.Text

Awesome, that was it. Now I'm trying to get the proper fields to fill out from the second drop down. This is what I did and I got a 'System.IndexOutOfRangeException: FirstName' error.

(One other piece of info ... I combined FirstName and LastName in the SQL statement so they'd both show in the 2nd drop down. I don't know if that matters or not.)

Dim str_sql2 As String = "SELECT * FROM Contacts WHERE contactID = " & DropDownList2.SelectedValue
        Using connection As New System.Data.SqlClient.SqlConnection("Data Source=IT-P02\SQLEXPRESS;Initial Catalog=HRIService;Integrated Security=True")
        Dim command As New System.Data.SqlClient.SqlCommand(str_sql, connection)
         connection.Open()
         Dim reader As System.Data.SqlClient.SqlDataReader = command.ExecuteReader()
         Try
       If reader.Read Then
        FirstName.Text = reader.Item("FirstName").ToString
        LastName.Text = reader.Item("LastName").ToString
        End If
         Finally
        ' Always call Close when done reading.
        reader.Close()
         End Try
        End Using

Also, what is the best way to reset the second drop down if a user goes back and changes the first ddl?

That error means there was no FirstName column returned from your query. I'd check your contacts table to see if maybe it is named "first_name" or just "name" in the database. As far as resetting the dropdownlist...

This resets it to the first option:

DropDownList2.SelectedIndex = 0

This clears all the options out:

DropDownList2.Items.Clear()

There is definitely a FirstName column in Contacts. Is there another possibility?

The clear ddl didn't work quite like I envisioned. If I go back and select a new company it doesn't reset the form unless I use the "0" one. Then it still has the contact from the first selection in the 2nd ddl.

Here is all the code. Maybe you can see something that is causing that OutofRange error that I can't.

Partial Class AddCall
    Inherits System.Web.UI.Page
    Protected Sub DropDownList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList2.SelectedIndexChanged
        'labelSelection.Text = DropDownList1.SelectedItem.Text & " " & DropDownList2.SelectedItem.Text
        DropDownList2.SelectedIndex = 0

        Dim Company As TextBox = TryCast(FormView1.FindControl("Company"), TextBox)
        Dim Address1 As TextBox = TryCast(FormView1.FindControl("Address1"), TextBox)
        Dim Address2 As TextBox = TryCast(FormView1.FindControl("Address2"), TextBox)
        Dim Phone As TextBox = TryCast(FormView1.FindControl("Phone"), TextBox)
        Dim FirstName As TextBox = TryCast(FormView1.FindControl("FirstName"), TextBox)
        Dim LastName As TextBox = TryCast(FormView1.FindControl("LastName"), TextBox)

        Dim str_sql As String = "SELECT * FROM Customers WHERE cusID = " & DropDownList1.SelectedValue
        Using connection As New System.Data.SqlClient.SqlConnection("Data Source=IT-P02\SQLEXPRESS;Initial Catalog=HRIService;Integrated Security=True")
            Dim command As New System.Data.SqlClient.SqlCommand(str_sql, connection)
            connection.Open()
            Dim reader As System.Data.SqlClient.SqlDataReader = command.ExecuteReader()
            Try
                If reader.Read Then
                    Company.Text = reader.Item("Company").ToString
                    Address1.Text = reader.Item("Address1").ToString
                    Address2.Text = reader.Item("Address2").ToString
                    Phone.Text = reader.Item("Phone").ToString
                End If
            Finally
                ' Always call Close when done reading.
                reader.Close()
            End Try
        End Using

        'Dim str_sql2 As String = "SELECT * FROM Contacts WHERE contactID = " & DropDownList2.SelectedValue
        'Using connection As New System.Data.SqlClient.SqlConnection("Data Source=IT-P02\SQLEXPRESS;Initial Catalog=HRIService;Integrated Security=True")
        'Dim command As New System.Data.SqlClient.SqlCommand(str_sql, connection)
        ' connection.Open()
        'Dim reader As System.Data.SqlClient.SqlDataReader = command.ExecuteReader()
        'Try
        'If reader.Read Then
        'FirstName.Text = reader.Item("FirstName").ToString
        ' LastName.Text = reader.Item("LastName").ToString
        ' End If
        ' Finally
        'Always call Close when done reading.
        'reader.Close()
       ' End Try
        ' End Using

    End Sub

End Class

I think you want to reset your second dropdownlist when someone changes the first one. So you'd need something like this.

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged 
  DropDownList2.SelectedIndex = 0
End Sub

I'd give this a try...

Dim Company As TextBox = TryCast(FormView1.FindControl("Company"), TextBox)
        Dim Address1 As TextBox = TryCast(FormView1.FindControl("Address1"), TextBox)
        Dim Address2 As TextBox = TryCast(FormView1.FindControl("Address2"), TextBox)
        Dim Phone As TextBox = TryCast(FormView1.FindControl("Phone"), TextBox)
        Dim FirstName As TextBox = TryCast(FormView1.FindControl("FirstName"), TextBox)
        Dim LastName As TextBox = TryCast(FormView1.FindControl("LastName"), TextBox)

        Dim str_sql As String = "SELECT * FROM Customers WHERE cusID = " & DropDownList1.SelectedValue
        Using connection As New System.Data.SqlClient.SqlConnection("Data Source=IT-P02\SQLEXPRESS;Initial Catalog=HRIService;Integrated Security=True")
            Dim command As New System.Data.SqlClient.SqlCommand(str_sql, connection)
            connection.Open()
            Dim reader As System.Data.SqlClient.SqlDataReader = command.ExecuteReader()
            Try
                If reader.Read Then
                    Company.Text = reader.Item("Company").ToString
                    Address1.Text = reader.Item("Address1").ToString
                    Address2.Text = reader.Item("Address2").ToString
                    Phone.Text = reader.Item("Phone").ToString
                End If
            Finally
                ' Always call Close when done reading.
                reader.Close()
            End Try
            str_sql = "SELECT * FROM CONTACTS WHERE contactID = " & DropDownList2.SelectedValue
            command = New System.Data.SqlClient.SqlCommand(str_sql, connection)
            reader = command.ExecuteReader()
            Try
                If reader.Read Then
                    FirstName.Text = reader.Item("FirstName").ToString()
                    'rest of them
                End If
            Catch ex As Exception
                reader.Close()
            End Try
        End Using

On the reset the drop down, it is still showing the original contact that I selected if I go back and select a new company. So it will have a new company and its contacts plus a contact from another company.

The other code worked like a charm! Now, what I'm trying to do is fill the city, state, zip info based on ddl1. I tried duplicating the code you just gave me, but that gave an error:

There is already an open DataReader associated with this Command which must be closed first.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.

Source Error:

Line 47: str_sql = "SELECT * FROM Zip WHERE zipID = " & DropDownList1.SelectedValue
Line 48: command = New System.Data.SqlClient.SqlCommand(str_sql, connection)
Line 49: reader = command.ExecuteReader()
Line 50: Try
Line 51: If reader.Read Then

Here is the code:

str_sql = "SELECT * FROM Zip WHERE zipID = " & DropDownList1.SelectedValue
            command = New System.Data.SqlClient.SqlCommand(str_sql, connection)
            reader = command.ExecuteReader()
            Try
                If reader.Read Then
                    City.Text = reader.Item("City").ToString()
                    State.Text = reader.Item("State").ToString()
                    Zip.Text = reader.Item("Zip").ToString()
                End If
            Catch ex As Exception
                reader.Close()
            End Try

This is the correct code for this....

Partial Class AddCall
    Inherits System.Web.UI.Page
    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
        DropDownList2.SelectedIndex = 0
    End Sub
    Protected Sub DropDownList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList2.SelectedIndexChanged
        'labelSelection.Text = DropDownList1.SelectedItem.Text & " " & DropDownList2.SelectedItem.Text
        
        Dim Company As TextBox = TryCast(FormView1.FindControl("Company"), TextBox)
        Dim Address1 As TextBox = TryCast(FormView1.FindControl("Address1"), TextBox)
        Dim Address2 As TextBox = TryCast(FormView1.FindControl("Address2"), TextBox)
        Dim Phone As TextBox = TryCast(FormView1.FindControl("Phone"), TextBox)
        Dim FirstName As TextBox = TryCast(FormView1.FindControl("FirstName"), TextBox)
        Dim LastName As TextBox = TryCast(FormView1.FindControl("LastName"), TextBox)
        Dim City As TextBox = TryCast(FormView1.FindControl("City"), TextBox)
        Dim State As TextBox = TryCast(FormView1.FindControl("State"), TextBox)
        Dim Zip As TextBox = TryCast(FormView1.FindControl("Zip"), TextBox)

        Dim str_sql As String = "SELECT * FROM Customers WHERE cusID = " & DropDownList1.SelectedValue
        Using connection As New System.Data.SqlClient.SqlConnection("Data Source=IT-P02\SQLEXPRESS;Initial Catalog=HRIService;Integrated Security=True")
            Dim command As New System.Data.SqlClient.SqlCommand(str_sql, connection)
            connection.Open()
            Dim reader As System.Data.SqlClient.SqlDataReader = command.ExecuteReader()
            Try
                If reader.Read Then
                    Company.Text = reader.Item("Company").ToString
                    Address1.Text = reader.Item("Address1").ToString
                    Address2.Text = reader.Item("Address2").ToString
                    Phone.Text = reader.Item("Phone").ToString
                End If
            Finally
                ' Always call Close when done reading.
                reader.Close()
            End Try
            str_sql = "SELECT * FROM CONTACTS WHERE contactID = " & DropDownList2.SelectedValue
            command = New System.Data.SqlClient.SqlCommand(str_sql, connection)
            reader = command.ExecuteReader()
            Try
                If reader.Read Then
                    FirstName.Text = reader.Item("FirstName").ToString()
                    LastName.Text = reader.Item("LastName").ToString()
                End If
            Catch ex As Exception
                reader.Close()
            End Try

            reader.Close()
            str_sql = "SELECT * FROM Zip WHERE zipID = " & DropDownList1.SelectedValue
            command = New System.Data.SqlClient.SqlCommand(str_sql, connection)
            reader = command.ExecuteReader()
            Try
                If reader.Read Then
                    City.Text = reader.Item("City").ToString()
                    State.Text = reader.Item("State").ToString()
                    Zip.Text = reader.Item("Zip").ToString()
                End If
            Catch ex As Exception
                reader.Close()
            End Try
        End Using

    End Sub
    
End Class

change this:

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
        DropDownList2.SelectedIndex = 0
    End Sub

To This:

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
        DropDownList2.SelectedIndex = 0
        FirstName.Text = ""
        LastName.Text = ""
    End Sub

That will reset your contact information.

damn this codebehind lol

Here's the updated code:

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
        Dim FirstName As TextBox = TryCast(FormView1.FindControl("FirstName"), TextBox)
        Dim LastName As TextBox = TryCast(FormView1.FindControl("LastName"), TextBox)
        DropDownList2.SelectedIndex = 0
        FirstName.Text = ""
        LastName.Text = ""
    End Sub

You'll need these lines in that Sub too...

Dim FirstName As TextBox = TryCast(FormView1.FindControl("FirstName"), TextBox)
Dim LastName As TextBox = TryCast(FormView1.FindControl("LastName"), TextBox)

Lol :) ... I'll blame it on my temporarily constipated Internet connection and poor typing skills.

What does my equipment ddl need to have specified in the datatextfield and datavaluefield in order to work?

I'm getting this error with mfgID in both of those now:

DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'mfgID'.

You must "select" "mfgID" from the database within the query. You get that error when you try assigning a value to mfgID when you did not select it as a value from the database.

For your equipment ddl, you should use something like this:
"SELECT eqpID, equipname FROM equipment"
Then you can assign the DataValueField = "eqpID" and the DataTextField = "equipname"

But you cannot assign anything to mfgID without selecting it from the database.

Post your code, I will help.

Here is my current ddl:

<asp:DropDownList ID="DropDownListEquip" runat="server" CssClass="maintext" 
                                                                                DataSourceID="Equipment" DataTextField="mfgID" DataValueField="mfgID">
                                                                            </asp:DropDownList>

DataSource:

<asp:SqlDataSource 
                                    ID="SqlDataSource3" 
                                    runat="server" 
                                    ConnectionString="<%$ ConnectionStrings:HRIServiceConnectionString1 %>"                                
                                    SelectCommand="SELECT [UserID], [FirstName]+ ' ' + [LastName] AS techid FROM [aspnet_Users] WHERE [isTech] = 'True' ORDER BY [LastName], [FirstName]">
                                </asp:SqlDataSource>
This question has already been answered. Start a new discussion instead.