This is a migrated thread and some comments may be shown as answers.

Web svc context menu, ClientState field grows on each postback

3 Answers 38 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Greg Chung
Top achievements
Rank 1
Greg Chung asked on 01 Oct 2008, 03:05 PM
Hi-

I'm using the Q1 RC for Ajax context menu, populated via web service, in an Ajaxified page.  I have noticed that upon each postback, the (generated) field "RadContextMenu1_ClientState" grows a little larger each time, even if the user never opened the context menu.  My app uses the context menu with no static root menu, based upon the example code posted by Telerik a while back.

After a number of postbacks, the field will look like this:
RadContextMenu1_ClientState, size 115 = {"logEntries":[{"Type":3},{"Type":3},{"Type":3},{"Type":3},{"Type":3},{"Type":3},{"Type":3},{"Type":3},{"Type":3}]}

I need the menu to be re-created via the webservice after every postback, because its state and contents change.  I do NOT include the context menu in the list of updated controls in the Ajax Manager.  Why?  Because even though all I'm doing in the .cs file is removing all the menu items, downloading the empty menu adds about 1.1K to my pagesize.  Therefore, I manually clear out all the menu items during the Ajax Manager handler, onResponseEnd:

    var menu = GetRadContextMenu();
    if (menu.get_persistLoadOnDemandItems())
    {
        menu.trackChanges();
        menu.get_items().clear();
        menu.commitChanges();
        menu._itemsLoaded = false;
    }

If I try to clean up the menu in the menu's item close handler, it interferes with my handling of the actual menu item click.  The menu works fine in this way EXCEPT that the Client State field just grows and grows by the "{"Type":3}" on each postback.

I could see no way to control this, except to add a hack to explicitly blank out the value in onResponseEnd():

form1.RadContextMenu1_ClientState.value = "";


Telerik, can you explain what's going on?  Am I doing something totally wrong here?

Many thanks..

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 01 Oct 2008, 04:27 PM
Hi Greg Chung,

Calling menu.trackChanges()  menu.commitChanges() is causing the client-state field to grow. It is constantly logging the "clear" operation (Type:3). If you don't need the changes to be persisted on the server side you should not call the trackChanges() / commitChanges() methods.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Greg Chung
Top achievements
Rank 1
answered on 01 Oct 2008, 05:36 PM
Thanks for that info.  However, your suggestion does not completely help.  If I don't use track/commit changes, the entire menu seems to be retained somewhere.  My page size increase by several KB every time I open the menu, cumulatively.

Could this because I'm explicitly clearing the menu, but I am also using PersistLoadOnDemandItems = true ?

0
Atanas Korchev
Telerik team
answered on 02 Oct 2008, 07:17 AM
Hi Greg Chung,

If PersistLoadOnDemandItems is set to true RadMenu will call internally track/commitChanges.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Menu
Asked by
Greg Chung
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Greg Chung
Top achievements
Rank 1
Share this question
or