Hello,
The original Code Library project demonstrates saving per-user settings for a single page. If you have multiple pages with identically named RadGrids that you want to save, you will need to extend the project a.
First, you need to make sure that no matter that two RadGrids have the same ID in two different pages, they need to be referenced by different names in the
Pet.Names hashtable. A suggestion would be to use a name formed by appending the control ID to the Page URL:
C#
VB.NEt
You can now use the above function to get a unique ID for the Hashtable containing your settings.
The second step is to make sure all settings are saved to one and the same object. If you notice, the overriden
Render event re-initializes a new
Pet object and assigns it to
Profile.Pet. This means that every time a page is rendered, the
Profile.Pet object will contain only the settings of the rendered page. All previous settings will be removed.
For this reason, we need to add settings up to the same Pet object on all pages. Simply remove
so that you always have the same Pet object referenced.
Lastly, a small fix for the Pet class, to make sure we update the settings for an existing key, instead of trying to add a new key-value pair:
Was:
Is:
Regards,
Veli
the Telerik team