copying value of an asp dropdownlist to another dropdownlist on same form

Hi experts,

I'm using visual studio 2010 and sql server.

I have application using VB as the language.

So I have a web form with some with these asp controls on it.
A user enters the items in. If their Mailing Address is the same as their physical address
then they check the checkbox and the Physical Addres, Physical City, Physical State, and Physical ZipCode are copied from those textboxes and dropdownlist and then fill the mailing ones.

Textbox:            FirstName
Textbox:            LastName
Textbox:            Physical Address
Textbox:             Physical City
DropDownList:   Physical State
Textbox:             Physical Zip Code

Checkbox:  Mailing Address Same As Physical      

Textbox:            Mailing Address      
Textbox:            Mailing City
DropDownList:  Mailing State      
Textbox:            Mailing Zip Code

All the textboxes are varchar(100)
The dropdownlist contain int value, they are the PhysicalState_PK and MailingState_PK columns from the CustomerTable

The data comes from a table called CustomerTable which looks something like this:

the PhysicalState and MailingState columns from the customer table use the value in those columns to lookup the state from the table called StatesTable which looks like this:

States table

In my form I have a checkbox event called Protected Sub cboxPhysicalAsMailing_CheckedChanged

I have an if statement that looks like this:

If (cboxPhysicalAsMailing.Checked) Then

            Me.txtMailingAddr.Text = txtPhysicalAddr.Text
            Me.txtMailingCity.Text = txtPhysicalCity.Text
            Me.ddlMailingStates.SelectedIndex = ddlPhysicalStates.SelectedIndex
            Me.txtMailingZipCode.Text = txtPhysicalZipCode.Text

So when I check the checkbox I want all the values from the Physical items copied to the Mailing items on the form.

When I check the checkbox I notice that all the values of the textboxes are copied successfully but the only one not working is the dropdownlist called ddlMailingStates.

How would I handle copying the value from the dropdownlist called ddlPhysicalStates and then filling my dropdownlist called ddlMailingStates with the same value?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

for setting selected item in ddlMailingStates, you have to first add option items in that.
I mean, onlyafter having option items in ddlMailingStates, you can set selected index/value of that DropdownList.

For that you can refer below logic:

Option 1: While adding/binding option items to ddlPhysicalStates, add/bind same datasource to ddlMailingStates.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.