andudarev:Might be another way is to keep the IDs of elements in your Panel between PostBacks and then just read their values directly from Page.Form["itemID"].
Ugh, this still isn't working. I tried the Form collection and it worked - almost! I realized that I've got checkboxes, too....and ran into the same problem I've had in classic ASP where the checkbox value doesn't come across the Forms Request if it's not checked. :-/ I can't just check whether the checkbox is there or not because everything is dynamic and I don't know necessarily if there is a checkbox or not!
I'm not fully following the ViewState option. Some articles say that if I create my dynamic controls in the OnInit of the Page, the viewstate will persist - but I can't create this before the page loads...my dynamic controls are part of the GridView which is based on a querystring value. I saw that the order that I create, set values, and add the dynamic controls to their parents would matter. I tried that (creating new control, adding it to its parent, and then setting properties), but that didn't work either.
It sounds like maybe the data from the dynamic controls is somewhere in the viewstate already (as part of the panel I'm adding them to??), and I'm supposed to recreate those controls on postback and if they have the same ID they will retain the values. But I'm not recreating the controls on postback. I'm creating the controls dynamically in the EditItemTemplate of the GridView, and only want the data from the controls so I can do the database update after the user clicks "Update" on the GridView. I only need the data at this point. Additionally, even if I did write the control value to the ViewState, when do I do it? I don't want to write the old values, I want whatever the new values would be. It's like I'd need to add them to the ViewState after a user clicks on or changes the value, but before it submits and posts back?
Hmmmmm.....I'm back wondering if this is the best way to do what I want to do, or if there's some other way to handle it. How else might I display a list of items, and for each of those items present a dynamic set of property controls (unknown beforehand), and handle saving and updating these? I can post some more code, too, if that might help. Thanks for any ideas!