Re: [問題] UpdateProgress 控制項
※ 引述《ONLYSMART ()》之銘言:
: 小弟在asp.net網頁原始檔UpdatePanel控制項內放置一段圖片連接:如下
: <span style="font-weight: bold; font-size: 12pt">資料建檔</span>
: <asp:UpdateProgress ID="UpdateProgress1" runat="server">
: <ProgressTemplate>
: <img src="<%=ResolveClientUrl("~/Images/loading.gif") %>" alt="" />
: <span style="vertical-align: bottom;
: padding-left: 10px; padding-right: 5px">請稍候...</span>
: </ProgressTemplate>
: </asp:UpdateProgress>
: 正常情況下都可以引發一個正在工作中的圖片
: 現在有一個button 控制項,小弟在code 裡面加了這一段:如下
: protected void Page_Load(object sender, EventArgs e)
: {
: if (!IsPostBack)
: {
: this.ScriptManager1.RegisterPostBackControl(btnExport);
: }
: }
: protected void btnExport_Click(object sender, EventArgs e)
: {
: 前略......
: #region Post file to client
: if (!IsError)
: {
: Response.AppendHeader("Content-Disposition", string.Format
: ("attachment;filename={0}", Server.UrlEncode
: (System.IO.Path.GetFileName(strFileName))));
: Response.ContentType = "application/vnd.ms-access";
: Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
: Response.WriteFile(strFileName);
: Response.Flush();
: Response.Close();
: }
: #endregion
: }
: 這樣就不會跑出工作中的圖片,請問有何改進的辦法?
自問自答一下
在btnExport 屬性OnClientClick 那裡 加入一段javascript 如下:
function Waiting()
{
setTimeout("document.getElementById('UpdateProgress1').style.display
= 'block';", 500);
}
這樣就可以跑出來工作中的圖片
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.69.191.1
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章
-50
111