Managing dynamic controls in an ASP.NET page
May 8, 2008
The last couple of days (well actually for my parts it’s more like months or years) we have been discussion the management of dynamic controls in ASP.NET pages. In my experience this is a very common scenario and I haven’t still found a great way to handling it.
To explain better I’ll just a very simple fictive scenario; imagine that a page has a button “Create new control”. Next to the button is a textbox in which you can type the typename of the control to create (CheckBox, TextBox etc.). When you click the button the control, of the right type, is created.
Now for the “hard” part. Below the created control is another button “What was entered?”. When that button is clicked the code should, of course, read the content of the dynamically created control and print the value that was entered.
Pretty simple, eh? Well it’s not so...