zoukankan      html  css  js  c++  java
  • 让Updatepanel中的控件触发整个页面Postback

    GridView被Updatepanel包起来了,但是GridView上有一个Download的ImageButton, 局部刷新的话,无法下载文件, 所以用下面代码注册updatepanel中的download button每次点击都整个页面postback。
    for (int i = 0; i < this.GridViewSOPDocument.Rows.Count; i++)
                {
                    ImageButton imageButtonDownload 
    = (ImageButton)this.GridViewSOPDocument.Rows[i].FindControl("ImageButtonDownload");
                    
    if (imageButtonDownload != null)
                    {
                        ((ScriptManager)((VPJQueryMaster)
    this.Master).FindControl("ScriptManager1")).RegisterPostBackControl(imageButtonDownload);
                    }
                }

    Download方法:
    public void FileDownload(string filePath, string fileName, string systemFileName)
            {
                FileInfo DownloadFile
                        
    = new FileInfo(this.ApplicationPhysicalPath + filePath + "\\" + systemFileName);
                
    if (DownloadFile.Exists)
                {
                    Response.Clear();
                    Response.ClearHeaders();
                    Response.Buffer 
    = false;
                    Response.ContentType 
    = "application/octet-stream";
                    Response.AppendHeader(
    "Content-Disposition""attachment;filename="
                        
    + HttpUtility.UrlDecode(fileName, System.Text.Encoding.UTF8));
                    Response.AppendHeader(
    "Content-Length", DownloadFile.Length.ToString());
                    Response.WriteFile(DownloadFile.FullName);
                    Response.Flush();
                    Response.End();
                }
                
    else
                {
                    ShowAjaxMessage(
    "msg_public_download_file_does_not_exist");
                }
            }
  • 相关阅读:
    【卡西欧Fx-5800p系列教程】Pol()和Rec()正反算妙用
    《关于2013年全国测量人员最低工资标准的通知》
    易语言测量编程工具教程篇
    价值300元的《测量宝典》
    业界常用的和不常用cad快捷键
    角度格式批量转化弧度—易语言
    Web.config中 mode="RemoteOnly" 跟mode="On" 区别
    Oracle 批量修改某个用户下表的表空间
    JQuery radio单选框应用
    RadioButtonFor控件
  • 原文地址:https://www.cnblogs.com/songsh96/p/1529999.html
Copyright © 2011-2022 走看看