//public override void ProcessRequest(HttpContext context) //{ // context.Response.ContentType = "image/jpeg"; // Stream strm = ShowEmpImage(); // byte[] buffer = new byte[4096]; // int byteSeq = strm.Read(buffer, 0, 4096); // while (byteSeq > 0) // { // context.Response.OutputStream.Write(buffer, 0, byteSeq); // byteSeq = strm.Read(buffer, 0, 4096); // } // context.Response.BinaryWrite(buffer); //} //private Stream ShowEmpImage() //{ // ProductImageService.serProdctImage image = new ProductImageService.serProdctImage(); // DataSet dataset = image.ProductImage_GetImageTest(); // // Create a DataSet from Database // bool successful = false; // if (dataset.Tables[0].Rows.Count > 0) // { // // Move data from data row to screen // DataRow dr = dataset.Tables[0].Rows[0]; // byte[] img = (byte[])dr["imageone"]; // int byteSeq = strm.Read(buffer, 0, 4096); // if(successful) // { // } // } // else // { // //setInitialValues(); // //lbErrorViewPBI.Text = "No cat numb not selected"; // } //} //public bool IsReusable //{ // get // { // return false; // } //} protected void btAddImage_Click1(object sender, EventArgs e) { int productimageId = 0; try { productimageId = Convert.ToInt32(TextBox1mage.Text); } catch { productimageId = 0; } ProductImageService.serProdctImage image = new ProductImageService.serProdctImage(); DataSet dataset = image.ProductImage_GetImageTest(productimageId); if (dataset != null) { // A user can select a person from the grid GridViewTestImage.AutoGenerateSelectButton = true; // Set the DataSet to cotrols DataSource GridViewTestImage.DataSource = dataset; // Bind values to controls rows and columns GridViewTestImage.DataBind(); // Set control visible GridViewTestImage.Visible = true; Image1.ImageUrl = "~/Handler/Handler.ashx?productimageId=" + productimageId; Image3.ImageUrl = "~/Handler/Handler.ashx?productimageId=" + productimageId; } else { //lbErrorViewPBI.Text = "Sql sentence was not successful."; } }
//public static Image bytetoimage(Byte[] byt) //{ // MemoryStream ms = new MemoryStream(byt); // Image retuimage = Image.ReferenceEqual (ms); //} private void populateGridViewCustomers() { int productimageId = 0; try { productimageId = Convert.ToInt32(TextBox1mage.Text); } catch { productimageId = 0; } ProductImageService.serProdctImage image = new ProductImageService.serProdctImage(); DataSet dataset = image.ProductImage_GetImageTest(productimageId); //Byte[] imageData = new Byte[0]; ////imageData = (Byte[])(dataset.Tables[0].Rows[0]["imageone"]); //MemoryStream stream = new MemoryStream(imageData); if (dataset != null) { // A user can select a person from the grid GridViewTestImage.AutoGenerateSelectButton = true; // Set the DataSet to cotrols DataSource GridViewTestImage.DataSource = dataset; // Bind values to controls rows and columns GridViewTestImage.DataBind(); // Set control visible GridViewTestImage.Visible = true; } else { //lbErrorViewPBI.Text = "Sql sentence was not successful."; } }