AJAX loading Panel and NeedDatasource event

8 posts, 1 answers
  1. Kerry
    Kerry avatar
    61 posts
    Member since:
    Nov 2008

    Posted 23 Jul 2009 Link to this post

    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
  2. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 24 Jul 2009 Link to this post

    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.
  3. Kerry
    Kerry avatar
    61 posts
    Member since:
    Nov 2008

    Posted 24 Jul 2009 Link to this post

    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
  4. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 24 Jul 2009 Link to this post

    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.
  5. Kerry
    Kerry avatar
    61 posts
    Member since:
    Nov 2008

    Posted 24 Jul 2009 Link to this post

    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;

     

    }

    }

  6. Answer
    Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 27 Jul 2009 Link to this post

    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.
  7. Dan
    Dan avatar
    6 posts
    Member since:
    Sep 2009

    Posted 14 Sep 2009 Link to this post

    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?
  8. Dan
    Dan avatar
    6 posts
    Member since:
    Sep 2009

    Posted 14 Sep 2009 Link to this post

    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!
Back to Top