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

problem with ajaxRequest method

1 Answer 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve Goldberg
Top achievements
Rank 1
Steve Goldberg asked on 18 Feb 2009, 06:37 PM

I have a client side code in which I use the RadAjaxManager to make a service side request using the ajaxRequest method. The first time the ajax request is called in my javascript, I get a javascript error. Every time after that, the code works fine. The error says 'length' is null or not an object. I do not use length in any part of my web page or in any javascript. Moreover, it says it's occuring on line 20838...I do not even have that many lines! This makes me think it is a problem with Teleriks script. Below are some code snippets of what I am trying to do:

aspx:
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="ScriptManager1" runat="server"
        EnableTheming="True">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
.....

           <script>

                             function mouseUp(e) {

 

                                    //Initiate AJAX request to update the page
                                    //$find("<%=RadAjaxManager1.ClientID%>").ajaxRequest(arguments)

                                    var ajaxManager = $find("<%=RadAjaxManager1.ClientID%>");
                                    ajaxManager.ajaxRequest();
                                    alert(ajaxManager);

                                }
                            }
              </script>

code behind:
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
}
        

If it makes any difference, this is being done during a grid row being dragged onto a tree node and the ajax request is being made on the mouse up over a tree node.

Also, without the alert after the ajaxRequest(), I wouldn't see the javascript error...the code would never reach the signature in the code behind. Again, this only occurs on the first time the code runs throught...each subsequent time it functions as desired.


I just discovered that the ajaxRequest() doesn't go to the code behind on the first call only when it inside a check I am making. If I put it outside an if statement, the request goes to my code behind to execute the code. However, during this first call, the javascript method is reaching and finding the ajax manager. 

if (destinationNode) {

                                    var ajaxManager = $find("<%=RadAjaxManager1.ClientID%>");
                                    alert('ajaxManager ');

                                    ajaxManager.ajaxRequest();
}

...Above: the alert gets hit but the ajaxRequest never posts to the code behind (on the first call only)

If I move this code outside of the if statement, the request gets made. This seems odd. Does it look like I have a problem?

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 23 Feb 2009, 10:14 AM
Hello Steve,

Based on this information, it is hard to determine what is causing this unwanted behavior. If the issue persists at your end, you can open a formal support ticket, and send us a small working project, demonstrating your implementation, and the unwanted behavior. We will debug it locally, and get back to you with additional information.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Steve Goldberg
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or