AjaxRequest Causes ViewState Postback

3 posts, 0 answers
  1. Andy
    Andy avatar
    25 posts
    Member since:
    Nov 2008

    Posted 08 Sep 2009 Link to this post

    Hi,

    I have a page with a RadTreeView. Double-clicking an item on the tree opens the item in a RadWindow, using entirely client-side javascript.

    When the RadWindow is closed by clicking the 'X', I use a client-side OnRadWindowClose event to pass the NavigateURL of the closed RadWindow to the server via ajaxRequest.

            function OnRadWindowClose(radWindow)  
            {  
                if (NoOfWindowsOpen > 1){  
                    NoOfWindowsOpen -= 1;  
                }  
                else {  
                    NoOfWindowsOpen = 0;  
                }  
                RaiseServerSideAjaxRequest('closewindow', radWindow.GetUrl());   
            }  
     
            function RaiseServerSideAjaxRequest(event, argument)  
            {  
     
                var tempAjaxManager = $find("<%=RadAjaxManager1.ClientID%>");  
                if (tempAjaxManager)  
                {  
                    ajaxManager = tempAjaxManager;  
                }  
                ajaxManager.ajaxRequest(event + ',' + argument);   
            }  
     


    The problem is that my RadTreeView can be extremely large and the AjaxRequest causes the entire ViewState to be posted back to the server. I see this using HttpWatch.

    This causes a very long delay when closing the RadWindow. I do not need to update any client-side controls when the RadWindow is closed. I simply want to record in the database that it was closed.

    Is there a way to use RadAjaxManager to send the AjaxRequest without causing the ViewState to be posted back?
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Sep 2009 Link to this post

    Hello Andy,

    You can use RadCompression to compress the page ViewState or event put the state in Session. Other possible approach is to use page method instead of traditional ajax request.

    Sincerely yours,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Andy
    Andy avatar
    25 posts
    Member since:
    Nov 2008

    Posted 09 Sep 2009 Link to this post

    Many thanks, Vlad,

    I was already using RadCompression but I didn't know about the 'page method'. I have tried that and it works brilliantly. Now my RadWindow closes instantaneously without a long delay!

    Thanks again,

    Andy
Back to Top