Here i have three DropDownList but you can have more that that as per your requirement. But i am having only single OnSelectedIndexChanged event for them.
HTML:
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" DataSourceID="SqlDataSource1"
OnSelectedIndexChanged="DropDownList1_OnSelectedIndexChanged" DataTextField="LastName"
DataValueField="EmployeeID">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="true" DataSourceID="SqlDataSource1"
OnSelectedIndexChanged="DropDownList1_OnSelectedIndexChanged" DataTextField="LastName"
DataValueField="EmployeeID">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="true" DataSourceID="SqlDataSource1"
OnSelectedIndexChanged="DropDownList1_OnSelectedIndexChanged" DataTextField="LastName"
DataValueField="EmployeeID">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConString %>"
SelectCommand="SELECT [EmployeeID], [LastName] FROM [Employees]"></asp:SqlDataSource>
<br />
<asp:TextBox ID="txtAddress" runat="server" TextMode="MultiLine" />
</div>
</form>
VB.NET:
Protected Sub DropDownList1_OnSelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim ddl As DropDownList = TryCast(sender, DropDownList)
Dim constr As String = ConfigurationManager.ConnectionStrings("ConString").ConnectionString
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("SELECT Address FROM Employees WHERE EmployeeID = @EmployeeID", con)
Using da As New SqlDataAdapter(cmd)
cmd.Parameters.AddWithValue("@EmployeeID", ddl.SelectedItem.Value)
con.Open()
Dim address As Object = cmd.ExecuteScalar()
con.Close()
Me.txtAddress.Text = address.ToString()
End Using
End Using
End Using
End Sub
Thank You.