I'm trying to create a generic control which adds property-controls based on the properties of a selected type. When the user selects the item-type and clicks 'Add', a new object of this type is added to the list.Then the object is checked using reflection and the necessary property-controls are added (using CreateEditControls) and set up (using SetupControl). This part works fine.
The problem is when the user then fill in a value and clicks 'Save'. During the postback, the list (stored in the control-state) is loaded and the controls are re-created and set up again. Then the 'ApplyEditChanges' is called to save the values from the controls back to the list. Unfortunately, the control has no value!When the user re-opens the page, the right controls are shown, but they're empty. When the user now enters a value and clicks 'Save', the control DOES have the value and saves correctly.
What is causing this behaviour?
I also tried without the control-state, but then adding the control didn't even work and it seems like the default value is loaded every time and I'm unable to update it.