protected void grdData_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument.ToString()); if (e.CommandName == "download") { DataSet ds = obj.GetPresentionbyConceptId(id); DataRow dr = ds.Tables[0].Rows[0]; Byte[] data = (Byte[])dr["ContentFile"]; Response.Clear(); MemoryStream ms = new MemoryStream(data); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=Presentation." + dr["Extension"]); Response.Buffer = true; ms.WriteTo(Response.OutputStream); Response.End(); } if (e.CommandName == "editrec") { DataSet ds = obj.GetPresentionbyConceptId(id); txtNameOfIdea.Text = ds.Tables[0].Rows[0]["ContentText"].ToString(); btnSave.Text = "Update"; btnSave.Enabled = true; hidConceptId.Value = id.ToString(); } if (e.CommandName == "deleterec") { bool flag = obj.DeletePresentation(id); if (flag) { lblMessage.Text = "Presentation deleted success"; } else { lblMessage.Text = "Presentation not deleted."; } BindData(); } }