views:

1705

answers:

3

I have a 4 dropdown boxes. The first 2 will populate the 3rd box. The 3rd box populates the 4th dropdown. When I go to submit, I go get the selectedvalue of the 4th dropdown. For some reason this is always the first value and not the actual selected value. The screen clearly shows another item selected. What may be the problem? Thanks

+3  A: 

Are you binding the dropdownlist in your page load? Page_Load happens before control events like button submit. So, if you rebind in the page_load before you check the value in the button_submit, it will be reset to the first value in the list.

You can generally avoid this by using the following

Page_Load:

If Not Page.IsPostback() Then
    ''//Bind controls here
End If

If that's not the case, please elaborate on how you bind and use these controls.

EndangeredMassa
A: 

No I'm not binding it in the page_Load. The dropdown is only binded whenever the 3rd dropdown selectedvalue changes.

Can you post the code behind for this page?
EndangeredMassa
Yes, post the code, it would be easier to help.
Slavo
A: 

Endangered Massa , You are right!!