Blog
.NET
ajaxcontroltoolkit
Best Practices
Blog
business tip
c#
Categories
comments
css
Database
email
Excel
flickr
GoDaddy
Google Analytics
Google Webmaster Tools
Hosting
IIS
Kentico CMS
linq
minne*
minnebar
MS SQL
MSSQL
MVC
MySQL
networking
peripheral
Rackspace Cloud
robots.txt
RSS
scripts
seo
service
sitemap.xml
Social Networking
tags
Title
trackbacks
training
twitter
Vista
Visual Studio
WordPress
xhtml
DropDownList value lost on PostBack
June 10, 2009 Author: Joel
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.
-
Categories
- asp.net (12)
- Blog (3)
- Business (5)
- Conferences (1)
- Errors (5)
- Office (1)
- Portfolio (3)
- Reviews (3)
- SEO (4)
- SQL Server (4)
- Tips (2)
- Uncategorized (2)
- Web Development (14)
-
Archives