Dynamically Generated DropDownList in GridView Lose Selected Values On PostBack

I'm generating dropwdownlists(ddl) in a gridview using ITemplate. When selections are made in the ddls
and the form is submitted the form builds before the OnRowCommand or submit button event handlers are fired. How can I access the the selected values on PostBack?
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.

Joel CoehoornDirector of Information TechnologyCommented:
Whenever you have a dynamically generated control of any type that loses state on postback, it almost always comes down to a page lifecycle problem.

In a nutshell, your page is recreated from scratch every time it reloads, including on postback.  This means you have to re-create your dynamic controls as well.  One of the things that happens while the page loads is to bind state information for each control on the page.  However, it can only do this if the control already exists at that point in the life cycle.  So what's likely happening is that you aren't re-creating your dynamic control early enough in the page lifecycle for the state information get loaded.

These links really helped me understand the problem when I first ran into it:

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
wsmith5204Author Commented:
I'm generating the controls in the OnInit() method. Is the an earlier point in the page lifecycle I can generate them (pre-init)?
Joel CoehoornDirector of Information TechnologyCommented:
IIRC, OnInit is the correct place, ASP.Net 2.0 has a PreInit, and ASP.Net 1.1 does not.  
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
.NET Programming

From novice to tech pro — start learning today.