C# – Handling dynamically generated controls in asp.net

asp.netc

What's the best way to handle data entered through dynamically generated controls in ASP.NET?

Currently, I have a group of controls that are generated in the Page_Load stage, and I need to access the data from them. It seems like it might be possible to just use a hidden field that's read and parsed on postback, but I'd like to know if there's a better way to do it that makes better use of the framework.

Best Answer

The key is recreating the controls on postback.

Old but good article to explain how and why.

You can also use the request.form collection to grab the posted values.