nduguyettu
asked on
Populating a Dropdown list
I have three Dropdown lists. The second and third Dropdown lists are populated basing on the selected itetm in the previous Dropdown list. I use the SelectedIndexChanged procedure to populate the Dropdown lists. It so happens that when there is only one item in the previus Dropdown list, the next Dropdown list cannot be populated.
How can I solve this problem?
Nduguyettu
How can I solve this problem?
Nduguyettu
Private Sub aDistrictOfBirth_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles aDistrictofBirth.SelectedIndexChanged
Dim t As New NameSpaceNdugu.SQLService
Dim ds As DataSet
sql = "Select Distinct CountyName from District where DistrictName = '" & aDistrictOfBirth.SelectedItem.Value & "'"
ds = t.Populate(conStr, sql)
aCounty.DataSource = ds.Tables("vTable").DefaultView
aCounty.DataBind()
End Sub
Private Sub aCounty_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles aCounty.SelectedIndexChanged
Dim t As New NameSpaceNdugu.SQLService
Dim ds As DataSet
sql = "Select Distinct SubCountyName from District where CountyName = '" & aCounty.SelectedItem.Value & "'"
ds = t.Populate(conStr, sql)
aSubCounty.DataSource = ds.Tables("vTable").DefaultView
aSubCounty.DataBind()
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nduguyettu