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

Making Ajax Request window.onload

2 Answers 279 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Patrick Cravens
Top achievements
Rank 2
Patrick Cravens asked on 06 Feb 2008, 04:10 PM

We have a long running process on a couple of our pages.  Our technique is to load the page (with plenty of graphics) and then call an Ajax to load the long running process that will show up in a WebUserControl when finished. 

In the past we used:

<
telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
function MakeAjaxRequest(arguments) {
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
ajaxManager.AjaxRequest(arguments);
}
window.onload = MakeAjaxRequest();
</script>
</telerik:RadScriptBlock>

This used to work fine in RadAjax, but since experimenting with Prometeus it doesn't seem to work - we get a javascript error stating "ajaxManager has no properties" and no ajax call is made.

Please Help! I've tried body onload and RadCodeBlock and all sorts of other things.  If there is a better approach then please let me know.

2 Answers, 1 is accepted

Sort by
0
Accepted
Jason Maronge
Top achievements
Rank 1
answered on 07 Feb 2008, 04:47 PM
Patrick,

You could try something like this:

ScriptManager.RegisterStartupScript(this.Page,typeof (string),"start","Sys.Application.add_load(function(){MakeAjaxRequest();});",true); 

I have had issues with accessing the prometheus controls before the page is loaded.  Using the Sys.Application.add_load seems to work for me.

Jason

0
Nick
Top achievements
Rank 2
answered on 24 Mar 2009, 08:44 PM
Tags
Ajax
Asked by
Patrick Cravens
Top achievements
Rank 2
Answers by
Jason Maronge
Top achievements
Rank 1
Nick
Top achievements
Rank 2
Share this question
or