Hi,
I'm trying to build up a portal home page that retrieve a big amount of data. One of the best options i had is to load the homepage (first half) and then fire ajaxRequest calls to retrieve the rest of sections upon the load completion (second lower half).
below are the scenario steps I'm trying to achieve,
I implemented the above scenario using RadAjaxPanel and it worked so fine, however using RadAjaxManager is much better as per several articles posted on your forum.
I tried hard to implement the above scenario using RadAjaxManager, and almost succeeded however the content is not updated even after a successful ajaxRequest, I traced the whole solution from the point of the first request and every thing works fine however it does not update the DIVs.
below is the XHTML code,
and here is the code behind,
Note: this scenario is an updated version for the below scenario and issue,
http://www.telerik.com/community/forums/aspnet-ajax/ajax/loading-panel-not-displaying.aspx
Awaiting your reply
Happy new year :-)
I'm trying to build up a portal home page that retrieve a big amount of data. One of the best options i had is to load the homepage (first half) and then fire ajaxRequest calls to retrieve the rest of sections upon the load completion (second lower half).
below are the scenario steps I'm trying to achieve,
- user request homepage
- homepage loads and a JavaScript fires to call for the first ajaxRequest
- first call is made, and once done it fires the next ajaxRequest "since you can't retrieve all sections in parallel"
- point number 3 keeps recurring several time until all sections are retrieved
I implemented the above scenario using RadAjaxPanel and it worked so fine, however using RadAjaxManager is much better as per several articles posted on your forum.
I tried hard to implement the above scenario using RadAjaxManager, and almost succeeded however the content is not updated even after a successful ajaxRequest, I traced the whole solution from the point of the first request and every thing works fine however it does not update the DIVs.
below is the XHTML code,
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title></title> |
<style type="text/css"> |
.MyAjaxLoadingPanel |
{ |
background:#fff url(images/ajax-loader.gif) center center no-repeat; |
} |
</style> |
</head> |
<body onload="initTimer();return false;"> |
<form id="form1" runat="server"> |
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
</telerik:RadScriptManager> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" |
RequestQueueSize="5" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> |
<ClientEvents OnResponseEnd="reqEnd" /> |
</telerik:RadAjaxManager> |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server" |
BackColor="White" EnableViewState="False" CssClass="MyAjaxLoadingPanel"> |
<div style="width:100%; padding-top:20px; text-align:center; font-family:Tahoma; font-size:12px;" >Loading...</div> |
</telerik:RadAjaxLoadingPanel> |
<div style=" background-color:#eeeeee;width:400px; height:200px;" ID="div1" runat="server"> |
<br /> |
<ul> |
<asp:Repeater ID="Repeater1" runat="server" EnableViewState="False"> |
<ItemTemplate> |
<li> |
<%#Container.DataItem("column")%> |
</li> |
</ItemTemplate> |
</asp:Repeater> |
</ul> |
</div> |
<br /> |
<div style=" background-color:#eeeeee;width:400px; height:200px;" ID="div2" runat="server"> |
<br /> |
<ul> |
<asp:Repeater ID="Repeater2" runat="server" EnableViewState="False"> |
<ItemTemplate> |
<li> |
<%#Container.DataItem("column")%> |
</li> |
</ItemTemplate> |
</asp:Repeater> |
</ul> |
</div> |
<br /> |
<div style=" background-color:#eeeeee;width:400px; height:200px;" ID="div3" runat="server"> |
<br /> |
<ul> |
<asp:Repeater ID="Repeater3" runat="server" EnableViewState="False"> |
<ItemTemplate> |
<li> |
<%#Container.DataItem("column")%> |
</li> |
</ItemTemplate> |
</asp:Repeater> |
</ul> |
</div> |
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
<script language="javascript" type="text/javascript"> |
var id,id2,id3; |
function initTimer() { |
id= setTimeout('AJAXReq()', 5000); |
} |
function AJAXReq(){ |
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>"); |
ajaxManager.ajaxRequest("Sport"); |
clearTimeout(id); |
} |
function reqEnd(sender, eventArgs){ |
switch (eventArgs.get_eventArgument()) |
{ |
case "Sport": |
id2 = setTimeout('AJAXReq2()', 200); |
break; |
case "Health": |
id3= setTimeout('AJAXReq3()', 200); |
break; |
} |
} |
function AJAXReq2() { |
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>"); |
ajaxManager.ajaxRequest("Health"); |
clearTimeout(id2); |
} |
function AJAXReq3() { |
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>"); |
ajaxManager.ajaxRequest("Science"); |
clearTimeout(id3); |
} |
</script> |
</telerik:RadCodeBlock> |
</form> |
</body> |
</html> |
and here is the code behind,
Imports System.Data.SqlClient |
Partial Class test |
Inherits System.Web.UI.Page |
Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest |
Select Case e.Argument |
Case "Sport" |
Threading.Thread.Sleep(1000) |
Dim x As New Database |
Dim s1 As SqlDataReader = x.ExecuteReader("Select query") |
Me.Repeater1.DataSource = s1 |
Me.Repeater1.DataBind() |
s1.Close() |
RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadAjaxManager1, div2, Me.RadAjaxLoadingPanel1) |
Case "Health" |
Threading.Thread.Sleep(1000) |
Dim x As New Database |
Dim s1 As SqlDataReader = x.ExecuteReader("Select query") |
Me.Repeater2.DataSource = s1 |
Me.Repeater2.DataBind() |
s1.Close() |
RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadAjaxManager1, div3, Me.RadAjaxLoadingPanel1) |
Case "Science" |
Threading.Thread.Sleep(1000) |
Dim x As New Database |
Dim s1 As SqlDataReader = x.ExecuteReader("Select query") |
Me.Repeater3.DataSource = s1 |
Me.Repeater3.DataBind() |
s1.Close() |
End Select |
End Sub |
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
If Not Page.IsPostBack Then ' tried it without page.IsPostBack, however loading panel shows for all sections once an ajaxRequest is executed |
RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadAjaxManager1, div1, Me.RadAjaxLoadingPanel1) |
End If |
End Sub |
End Class |
Note: this scenario is an updated version for the below scenario and issue,
http://www.telerik.com/community/forums/aspnet-ajax/ajax/loading-panel-not-displaying.aspx
Awaiting your reply
Happy new year :-)