Linking 2 DropDownLists by DataBinding

I have Two DropDownLists, the main selection being from ddlLastName and the second being ddlCoCodes. The ddlCoCodes is to display the database value on ddlLastName selection. If adding a new LastName the ddlCoCodes is used to select the CoCodeID.

I have two DataAdapters one called daUsers and one called daCoCodes, the daUsers has columns containing LastName and CoCodeID. The daCoCodes also contains a CoCodesID column. Both daUsers & daCoCodes are stored in two DataSets named dsUsers & dsCoCode.

In ASP.NET To DataBind the DropDownLists I have the following settings:
ddlLastName.DataSource = dsUsers The DataSet
ddlLastName.DataMember = Users_TBL The DataSet table
ddlLastName.DataValueField = LastName The Column name to be displayed

ddlCoCodes.DataSource = dsCoCodes The DataSet
ddlCoCodes.DataMember = CoCodes_TBL The DataSet table
ddlCoCodes.DataValueField = CoCodeID The Column name to be displayed

ddlLastName.DataBind()
ddlCoCodes.DataBind()

Both DropDownLists work OK when selected.
My problem is to get the ddlCoCodes to display the Value of CoCodeID stored in the Users_TBL when a LastName is selected from the ddlLastName.

There is only ddlCoCode.Selected value left to place somewhere!. Can anybody shed light on this.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories