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

AjaxRequest Causes ViewState Postback

2 Answers 126 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 08 Sep 2009, 02:45 PM
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 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 Sep 2009, 02:54 PM
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.
0
Andy
Top achievements
Rank 1
answered on 09 Sep 2009, 07:36 AM
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
Tags
Ajax
Asked by
Andy
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Andy
Top achievements
Rank 1
Share this question
or