We have a WHDG as part of a user control. I need to be able to load and save it's settings, hopefully, using the persistence framework. I'm using the simple logic from the sameples browsers for manual persistence, but have found a few issues:
1) I doesn't appear the persistence framework (pf) will save column sizes or positions when AutoGenerateColumns is true. Is that correct? Wouldn't be a problem except that the column collection isn't built for me when AutoGenerateColumns=true like it was w/ultrawebgrid.
2) I need to be able to load/save settings after the page_load event but it's not clear when in the page life-cycle I have all the settings available, eg. when do I get column width's if no autopostback when column width changes?
3) I frequently get a "value can not be null error" for parameter name "key" when trying restore via:
manager.LoadControl(control, controlData)
but I'm not sure how to debug this or what it might be referring to. Still figuring out a steps to reliably recreate but it happens a lot.
Hello cantrellr,
When “AutoGenerateColumns” property is set to true, the columns of the grid are actually recreated from the Datasource on every Postback. This means that the columns that were available on the previous load will be destroyed and then recreated again. Since columns collection does not exist the persistence may not be saved/loaded properly.
In the manual load example the persistence data are loaded in “Page_InitComplete” event that is executed earlier than “Page_Load”. This is done in order to get the needed data before the control is actually loaded - http://samples.infragistics.com/aspnet/Samples/PersistenceFramework/EditingAndSelection/PersistControlManually/Default.aspx?cn=persistence-framework&sid=99bb0e9c-157a-4a98-a090-19d436175c68 – the data are then saved on “SelectedIndexChanged()” event of the dropdown (“ManualPersistence()” method).
In order to be able to research the error that is generated I will need a runnable example that can be used for debugging.
Can you send me the project that is generating this message in order to investigate this further?
I am waiting for your response.