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?