protected void rlv_ItemCommand1(object sender, Telerik.Web.UI.RadListViewCommandEventArgs e) { if (e.CommandName == "Select") { string[] index = e.CommandArgument.ToString().Split(new char[] { ',' }); var button = sender as Button; for (int i = 0; i < 19; i++) { if (int.Parse(index[0].ToString()) == i) { DataTable dt4 = FRB.GetInfoPeoByFilterPDF(int.Parse(Request.QueryString["ID"].ToString()), int.Parse(index[0].ToString())); Response.ContentType = "pdf";// doc.DOCUMENT_TYPE; Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=" + dt4.Rows[0]["document_name"].ToString() + " " + dt4.Rows[0]["name"].ToString() + " " + dt4.Rows[0]["family"].ToString() + (dt4.Rows[0]["ext"].ToString().Contains(".")?"":".") + dt4.Rows[0]["ext"].ToString()); Response.BinaryWrite((byte[])dt4.Rows[0]["scan_document"]); Response.Flush(); Response.End(); } } } if (e.CommandName == "ShowPic") { string[] index = e.CommandArgument.ToString().Split(new char[] { ',' }); var button = sender as Button; for (int i = 0; i < 19; i++) { if (int.Parse(index[0].ToString()) == i) { //Session["ID"] = Request.QueryString["ID"].ToString(); Response.Redirect("ShowPicture.aspx?" + "ID" + "=" + int.Parse(Request.QueryString["ID"].ToString()) + "&" + "TypePic" + "=" + int.Parse(index[0].ToString())); } } } }
protected void Page_Load(object sender, EventArgs e) { if ((!string.IsNullOrWhiteSpace(Request.QueryString["ID"].ToString())) || (!string.IsNullOrWhiteSpace(Request.QueryString["TypePic"].ToString()))) { DataTable dt4 = FRB.GetInfoPeoByFilterPDF(int.Parse(Request.QueryString["ID"].ToString()), int.Parse(Request.QueryString["TypePic"].ToString())); if (dt4.Rows.Count > 0) { if (dt4.Rows[0]["scan_document"] != DBNull.Value) { byte[] image = (byte[])(dt4.Rows[0]["scan_document"]); RadBinaryImage1.DataValue = image; } } } }