I'm changing around the edit product control on my sites. Products are complex entities that can be made up of any number of different smaller pieces. Kindof like legos for product metadata. The original edit control assumed that users would want to have access to all the bits of data when they added a new product to the database. To accomplish this I added all the information to treeview controls, but it is painfully slow because of the large number of nodes in the treeview. My original assumption was incorrect. Users know what they are adding and only need access to a few different pieces of information for each different product they are trying to sell. My solution is to create a template that defines which types of data the product is built on. This eliminates the need to have access to every bit of available metadata and allows the entire product edit control to load much quicker.
The challenge is to dynamically add the controls necessary to edit the information but maintain their state in postback. That way, the information that users enter won't be overwritten by the data used to initialize the control. Asp.net pages are rendered during each successive round trip to the server, so without using the built in mechanism (the viewstate) to handle the data, all hope for a quick solution would be lost. Essentially, here's my plan of attack. I have to add the controls to the page control heirarchy during the page init event. Then I set their values in the page load event. So far all is going well, but I'm not done yet. Time will tell if this new approach will work.