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

[Solved] XmlHttpRequest causes problems with RadGrids when using a RadAjaxManager

1 Answer 140 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 01 Oct 2009, 04:46 PM
XmlHttpRequest seems to cause problems with RadGrids when using a RadAjaxManager.

We are building a Website that has a few RadGrids and a RadAjaxManager.

Also on the page there is a client side timer initiated using window.setTimeOut() set to trigger every 15 seconds.

The event for the timer triggers an Asynchronous XmlHttpRequest using:

 

function SendRequest(url, CallbackFunc, send)  
{   
    var req = GetRequest();   
 
    req.open("Post", url, true);  
    req.send(send);  
 
    req.onreadystatechange =   
        function()   
        {   
            if (req.readyState != 4) return;  
            if (req.status != 200) return;  
 
            CallbackFunc();   
        };  
}  
 
 
function GetRequest()   
{   
    var req = false;   
   
    if (window.XMLHttpRequest && !(window.ActiveXObject))  
    {   
        try   
        {   
            req = new XMLHttpRequest();   
        }  
        catch (e)  
        {   
            req = false;   
        }  
     }   
     else if (window.ActiveXObject)   
     {   
        try   
        {   
           req = new ActiveXObject("Msxml2.XMLHTTP");    
        }  
        catch (e)   
        {   
           try   
           {   
              req = new ActiveXObject("Microsoft.XMLHTTP");   
           }  
           catch (e)   
           {   
              alert("Your browser does not support AJAX!");   
          
          req = false;  
            }  
        }  
     }  
 
    return req;   
}  
 
 

 
Then Sever side it generates an XML formatted string which it returns using:

Response.Write( MyXmlString);


It then recieves this in a client side event, parses the XML and displays the content using javascript.

This functionality all works fine but the problem is that introducing this code seems to cause strange behaviour on RadGrids. After the page has been running for a while, clicking on the radgrid will cause all it's data to disappear and postbacks seem to have completely lost their viewstate.

If I remove my XmlHttpRequest call then the RadGrids behave fine.

Are the RadAjaxManager and RadGrids compatible with the use Asynchrous Requests as described above? and does anyone have any ideas why an XmlHttpRequest would cause this problem?

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 07 Oct 2009, 06:18 AM
Hi Jonathan,

Please check out the answers to your questions provided in the other ticket you have open on the same subject and let me know if it works for your and if any issues arise.

Greetings,
Iana
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.
Tags
Ajax
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or