lnkBtnResumeDownload.OnClientClick = "DownloadFunction()"; this.btnDelete.Attributes.Add("OnClick", "return confirm('Are you sure you want to delete the selected Engagement ?');");
try { if (id > 0) { string strSql = string.Empty; strSql = string.Format("SELECT Attachment, FileExtn FROM Engagements WHERE EngID = {0}", id); DataSet ds = new DataSet(); ds = SQLHelper.ExecuteDataset(CONN_STRING, CommandType.Text, strSql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; if (!DBNull.Value.Equals(dr["Attachment"]) && !DBNull.Value.Equals(dr["FileExtn"])) { byte[] fileData = (byte[])dr["Attachment"]; Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("Content-Disposition", "attachment; filename=" + "temp." + dr["FileExtn"].ToString()); BinaryWriter bw = new BinaryWriter(Response.OutputStream); bw.Write(fileData); bw.Close(); Response.ContentType = ReturnExtension(dr["FileExtn"].ToString()); Response.Flush(); Response.Close(); } } } } catch (Exception ex) { ErrorHandling.ErrorLog("Page : ManageEngagements.ascx.cs ; Method : DownloadAttachment ; Error : " + ex.Message); lblDisplay.Text = "Error in loading data. "; }
<script language="javascript" type="text/javascript"> function DownloadFunction() { window.WebForm_OnSubmit = function() { return true; }; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)