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

[Solved] AJax Loading Panel

3 Answers 394 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Brete
Top achievements
Rank 1
Brete asked on 14 Mar 2008, 11:37 PM

Prometheus vs Rad. 

In Rad I was able to use

    ClientScript.RegisterStartupScript(cstype, "", " AjaxNS.AR('ctl00$ContentPlaceHolder1$Buttonx', '', 'ctl00_ContentPlaceHolder1_RadAjaxPanel1', event); ", true);

to Submit my page back to itself.  I am creating some images for the user and want to show the loading panel while the work is being done.  When the image finish creating the "Loading" would disapear. 

With Prometheus I can get the page to submit back to itself, but the loading panel does not appear.
I have tried:
ClientScript.RegisterStartupScript(cstype, "", " 'ctl00_ContentPlaceHolder1_Buttox.click(); ", true);

ScriptManager.RegisterStartupScript(Buttonx, cstype, "", " 'ctl00_ContentPlaceHolder1_Buttox.click(); ", true);

If I disable the start up script and just click the button the loading panel does appear. 

I can tell that is it is not firing the OnRequestStart event of the loading panel. 

What I am trying to accomplish is that the page loads - then automaticly post back to it self showing the loading panel.  Generate some user images in the code behind of the button click.  show the images - then hide the loading panel. 

Any help would be appreciated. 

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 17 Mar 2008, 08:10 AM
Hello Brete,

Can you let us know what does the Page.IsPostBack check returns upon "submitting your page to itself"? Is it by any change false? If this is the case, we believe it is understandable why OnRequestStart is not fired and why the loading panel does not appear, as reloading the page disposes the entire page including the loading panel.
If we are missing your point, please prepare a sample runnable page and provide a link to it or open a support ticket and attach it there. We will review it and advise you accordingly.

All the best,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Brete
Top achievements
Rank 1
answered on 17 Mar 2008, 02:27 PM
Is postback is True. 
AsyncPostback is false.
Callback is false.  


Here is a simplified version of the code.
_____________________________________________________

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="nltest.aspx.cs" Inherits="nltest" Title="Untitled Page" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>

    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px">

<table>
<tr>
<td>
 <asp:HyperLink ID="pg1" runat="server"></asp:HyperLink>
 <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" 
                    Width="75px" IsSticky="False">
                    <table><tr>    <td valign=top>
                 </td>
               </tr><tr>    <td valign=top><asp:Label ID="Label2" runat="server" CssClass="ered" Text="Please wait while we create your images....." Font-Size="XX-Large"></asp:Label>
               </td>
               </tr>
              
               </table>
                </telerik:RadAjaxLoadingPanel>

</td>

</tr>
<tr>

<td>
       <asp:Button ID="Buttonx" runat="server" Height="11px" OnClick="Buttonx_Click" Width="11px" />

</td>
</tr>

</table>

 

 

    </telerik:RadAjaxPanel>

</asp:Content>

______________________________________________________

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class nltest : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (Session["order"] == null)
        {
            Session["order"] = 5020;
            }

    }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            Type cstype = this.GetType();
            ClientScript.RegisterStartupScript(cstype, "", "__doPostBack('ctl00$ContentPlaceHolder1$Buttonx','');", true);
// I have tried many ways of "Clicking" the button from the client side. 
       
        }

    }

    protected void Buttonx_Click(object sender, EventArgs e)
    {
        //simulated create the images
        System.Threading.Thread.Sleep(3000);
        //create finished
        string createdimage =      @"project/orders/" + Session["order"].ToString() + "_pg1_1.jpg";
             
        pg1.ImageUrl = createdimage;

    }
}


The "Master" page in non-ajax.  It is just a image that goes around all the content pages. 
 




 
0
Steve
Telerik team
answered on 18 Mar 2008, 03:30 PM
Hi Brete,

I now see what you mean. Two things I've noticed:
  • you're missing the LoadingPanelID of the AjaxPanel and therefore the loading panel is never invoked.
  • invoking __doPostBack directly would not work with our Ajax. You should use the AjaxRequest() or AjaxRequestWithTarget() methods of the AjaxLoadingPanel.
  • make sure that you define the client events of the AjaxPanel within it. If you set them separately in the <clientevents section they would not work - this is a known bug.
Hope this helps.

Kind regards,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Ajax
Asked by
Brete
Top achievements
Rank 1
Answers by
Steve
Telerik team
Brete
Top achievements
Rank 1
Share this question
or