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);
}
}
{
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 " );
}
}
{
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 " );
}
}