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

AJAX loading Panel and NeedDatasource event

7 Answers 146 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Kerry
Top achievements
Rank 1
Kerry asked on 24 Jul 2009, 04:32 AM
Hello,

I have a RadGrid that is populated when the NeedDataSource event occurs which is normally at initial page load.  How can I get the AJAXLoadingPanel to start when the page is initially loaded. I seen the code at
http://www.telerik.com/community/forums/new-thread.aspx?forumId=186
But the javascript gives me an error that the "Object does not support this property or method"  ( this is on IE6).  I am not using an ASP:Panel just the AJAXLoadingPanel which I am setting the visible property to true. 

Can this not work without an ASP:Panel.

Can a RadGrid initiate an AJAX request to itself.

Thanks

7 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 24 Jul 2009, 09:31 AM
Hello Kerry,

Although RadAjaxLoadingPanel is designed to be shown on AJAX updates, someone would like to show it on initial page load as well. 
For more information about how to achieve this behavior please refer to this help article:
Show RadAjaxLoadingPanel on initial page load 

Sincerely yours,
Pavlina
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.
0
Kerry
Top achievements
Rank 1
answered on 24 Jul 2009, 01:46 PM
Thanks for your response, this example is using a ASP:Panel, is this absolutely necessary. I am not using a loading panel and I susspect this is why its not working for me.

Thanks Kerry
0
Pavlina
Telerik team
answered on 24 Jul 2009, 02:42 PM
Hello Kerry,

I am not sure if I understand your scenario completely. Could you please elaborate a bit more in the details?
Please note that in order to get the AjaxLoadingPanel to show when the page is initially loaded you should use RadAjaxLoadingPanel control.
More information about  how to use it you can find in the following link:
AJAX Loading Panel

Best wishes,
Pavlina
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.
0
Kerry
Top achievements
Rank 1
answered on 24 Jul 2009, 03:34 PM
Hi, the example at the link provided uses a ASP:Panel in addition to a AJAXLoadingPanel and sets the asp:panel visibility status to TRUE when the

RadAjaxManager1_AjaxRequest event is fired, I am not using a ASP:Panel I am only using the AJAX loading Panel.  I cannot get the loading panel to appear when the page is loaded...so I am wondering if its because I do not use the asp:panel.  Below I've included the blocks of code.  Thanks

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"

 

 

DefaultLoadingPanelID="RadAjaxLoadingPanel1"

 

 

onajaxrequest="RadAjaxManager1_AjaxRequest">

 

 

 

 

 

 

</telerik:RadAjaxManager>

 

 

 

 

 

 

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"

 

 

height="75px" MinDisplayTime="600" width="75px">

 

 

 

 

 

 

<img alt="Loading..."

 

 

src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'

 

 

style="border:0px;" />

 

 

 

 

 

 

</telerik:RadAjaxLoadingPanel>

 


<

 

telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

 

 

<script type="text/javascript">

 

 

function pageLoad(sender, eventArgs)

 

{

 

if (!eventArgs.get_isPartialLoad())

 

{

$find(

"<%= RadAjaxManager1.ClientID %>").ajaxRequest("InitialPageLoad");

 

}

}

 

</script>

 

 

</telerik:RadCodeBlock>

 



protected

 

void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)

 

{

 

if (e.Argument == "InitialPageLoad")

 

{

 

//simulate longer page load

 

System.Threading.

Thread.Sleep(2000);

 

RadAjaxLoadingPanel1.Visible =

true;

 

}

}

0
Accepted
Pavlina
Telerik team
answered on 27 Jul 2009, 02:09 PM
Hi Kerry,

I am sending you a simple runnable application that demonstrates the needed approach. Please give it a try and let me know if you have other questions or problems.

Greetings,
Pavlina
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.
0
Dan
Top achievements
Rank 2
answered on 14 Sep 2009, 02:54 PM
This example is fine, but the both the Page_Load event and the NeedDataSource event for the RadGrid control are fired before the AjaxRequest event of the RadAjaxManager object is fired.  If you add a grid to the example provided, you will notice that all the data gets loaded before the panel is made visible.  This is too late in the process.  Are there any examples that have an initial loading panel on the same page as a RadGrid control?
0
Dan
Top achievements
Rank 2
answered on 14 Sep 2009, 06:36 PM
I figured out a workaround....I used a session variable to keep track of whether or not the page is being initially loaded.  The code in the Page_Load and NeedDataSource events are bypassed if it's the initial page load.  When the AjaxRequest event fires, it flips the session flag and calls the methods I bypassed in Page_Load and NeedDataSource--all after starting the loading animation.  Works like a charm!
Tags
Ajax
Asked by
Kerry
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Kerry
Top achievements
Rank 1
Dan
Top achievements
Rank 2
Share this question
or