I want to pass an image of GridView
to a table that has the IMG tag.
I was previously passing data from DataGridView
to TexBox
and it worked for me. Now the problem is that it can not be shown on that label.
This is the code I use to pass data:
protected void DtgSolicitudes_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
try
{
DtSet = new DataSet();
SqlConnection con = new SqlConnection(ObtenerCadenaConexion());
con.Open();
DtgSolicitudes.SelectedIndex = Convert.ToInt32(e.CommandArgument);
GridViewRow row = DtgSolicitudes.SelectedRow;
SqlCommand cmd = new SqlCommand("SP_BuscarSeguimiento", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = new SqlParameter("OPT", 2);
SqlParameter p2 = new SqlParameter("periodo", "");
SqlParameter p3 = new SqlParameter("oficina", "");
SqlParameter p4 = new SqlParameter("rubro", row.Cells[3].Text);
cmd.Parameters.Add(p1);
cmd.Parameters.Add(p2);
cmd.Parameters.Add(p3);
cmd.Parameters.Add(p4);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
TextBox1.Text = Convert.ToString(row.Cells[2].Text);
TextBox2.Text = Convert.ToString(row.Cells[1].Text);
TextBox3.Text = Convert.ToString(row.Cells[3].Text);
TextBox4.Text = Convert.ToString(row.Cells[4].Text);
TextBox5.Text = Convert.ToString(row.Cells[5].Text);
TextBox6.Text = Convert.ToString(row.Cells[6].Text);
TextBox7.Text = Convert.ToString(row.Cells[7].Text);
TextBox8.Text = Convert.ToString(row.Cells[8].Text);
TextBox9.Text = Convert.ToString(row.Cells[9].Text);
Image1.ImageUrl = Convert.ToString(row.Cells[12].Text);
var imagen = row.FindControl("img") as Image;
con.Close();
}
catch (Exception Ex)
{
// DvError.Visible = true;
Session["13"] = Ex.Message;
}
}
}
SQL SERVER MY TABLE
I get the image with that name byte
blank: