Updateprogress不适用于PostBackTrigger [英] Updateprogress not working with PostBackTrigger

查看:77
本文介绍了Updateprogress不适用于PostBackTrigger的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个页面test.aspx,它有一个按钮,可以在updatepanel和一个updateprogress加载器下打开ppt。

在页面加载中我把这段代码

Hi,

I have page "test.aspx", which has a button to open ppt under an updatepanel and one updateprogress loader.
in the page load i put this code

ScriptManager.GetCurrent(this.Page).RegisterPostBackControl(Button1);



当我点击一个按钮ppt打开但updateprogress没有显示

我怎样才能显示更新进度当我有registerpostback control。



请帮助..


when i click on a button ppt opens but the updateprogress not shows
how can i display the update progress when i have registerpostback control.

please help..

推荐答案

我在搜索时找到了解决方案。



我删除了



ScriptManager.GetCurrent(this.Page).RegisterPostBackControl(Button1);





并在scriptmanager中添加如



I found the solution when I was searching.

I removed

ScriptManager.GetCurrent(this.Page).RegisterPostBackControl(Button1);


and added in scriptmanager like

<asp:ScriptManager ID="ScriptManager1" runat="server">
        <Scripts>
        <asp:ScriptReference Path="js/iframe.js" />
      </Scripts>
        </asp:ScriptManager>




iframe.js中的
我重定向到另一个页面,其中包含打开PPT的代码。



iframe.js代码





in the iframe.js I redirected to another page which has code to open PPT.

iframe.js code

Sys.Application.add_init(AppInit);

function AppInit() {
  var prm = Sys.WebForms.PageRequestManager.getInstance();
  prm.add_endRequest(InitializeRequest);
}

function InitializeRequest(sender, args) {
  // Check to be sure this async postback is actually
  //   requesting the file download.
    if (sender._postBackSettings.sourceElement.id == "ContentPlaceHolder1_BtnCrBreview") {
        // alert(sender._postBackSettings.sourceElement.id);
        // Create an IFRAME.

        var iframe = document.createElement("iframe");

        // Get the desired region from the dropdown.


        // Point the IFRAME to GenerateFile, with the
        //   desired region as a querystring argument.
        iframe.src = "OpenPPT.aspx";

        // This makes the IFRAME invisible to the user.
        iframe.style.display = "none";

        // Add the IFRAME to the page.  This will trigger
        //   a request to GenerateFile now.
        document.body.appendChild(iframe);
    }

another page OpenPPT.aspx.cs code

 protected void Page_Load(object sender, EventArgs e)
    {
        System.IO.FileInfo file = new System.IO.FileInfo(Server.MapPath("Output/Presentation1.pptx"));

        Response.Clear();
        Response.ContentType = @"application\octet-stream";
      //  System.IO.FileInfo file = new System.IO.FileInfo(Server.MapPath("Output/Presentation1.pptx"));
        Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.ContentType = "application/octet-stream";
        Response.WriteFile(file.FullName);
        Response.Flush();
    }


这篇关于Updateprogress不适用于PostBackTrigger的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆