Handling dynamically created controls in asp.net

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

I currently have a bunch of controls that are generated in the Page_Load step and I need to access data from them. It looks like one could just use a hidden field that was read and parsed on postback, but I would like to know if there is a better way to do this to make better use of the framework.

+1


source to share


3 answers


The key recreates the controls on postback.

An old but good article to explain how and why.



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

+3


source


redsquare is correct. If you can just remember that ASP.Net is a lie wrapped around Http, then you should be fine. In the browser, it doesn't matter that MS neatly abstracts the Http request / response from you in the form of web controls. He only knows that he needs to wrap each of the form variables and their corresponding values ​​and send them back to the server via Http.



+1


source


You want dynamic controls to be kept to a minimum, ESPECIALLY if you add events to them.

I am using @redsquare in the ASP.NET MVC recommendation.

0


source







All Articles