Client-side Settings

Feb 15, 2009 at 8:49 PM
Been playing around with the best way to implement client-side settings for anonymous and authenticated users and I believe I have the basic setup.

When a user browses to the module for the first time (IsPostBask = False), I check to see if cookies are initialized in the module's base container. If not, I create them and set public property values for the subcontainers which are then persisted in the view state. When there is a change to the public property, we write a new cookie value back to the client-side.

The effect is pretty nice. I can now add things like dropdownlists to the grids that let guests specify how many items per page they want to display. When they change the value, we write a new cookie. If the user should happen to close the window and return to the website at a later date, the cookie will be read and the value re-established.

One might ask why we just don't use the cookie all the time... good question. The problem is that cookies can only be read at certain times. During Page_load is acceptible, but subcontainers do not trigger new Page_load events, so the cookie value is unreliable for subsequent postbacks.

This is a proof of concept, so now I have to develop it. This will also be instrumental in implementing grid filtering.

I've also setup the basic code structure for allowing multi-item updates. This will go hand-in-hand with filtering for various reasons.