call today Call Today 320.281.0605

DropDownList value lost on PostBack

June 10, 2009

I had two dropdownlists. One that was hard-coded in the .aspx page and one that was being dynamically populated in the code-behind.  I had a requiredfieldvalidator on both.. 

When I submit it would get past the client side validation.  Server side validation
If(Page.IsValid) was failing.

It would come back to the page saying that I needed to choose a value for my dynamically populated ddl.

For the life of me I couldn’t figure it out.

Finally I noticed at the top in the page directive:

EnableViewState="false"

I set this to true and it worked.

Conclusion: if you’re finding values aren’t making it to the code-behind check your ViewState.

I hope this saves someone else the time I lost debugging it.

  • Share/Bookmark
Agent Cody Banks 2 Destination London full lenght movie download Afghan Knights download movie Inside the Smiths download movie Beverly Hills Chihuahua download movie Permanent Vacation download movie Indiana Jones and the Kingdom of the Crystal Skull download movie Afghan Knights download movie Inside the Smiths download movie Beverly Hills Chihuahua download movie Permanent Vacation download movie Indiana Jones and the Kingdom of the Crystal Skull download movie