title: GridView cannot display image
body: <p>Sorry for troubling. Im trying to display the selected fields in a asp.net gridview. i can display everything except the "product_img" where i should display the relevant picture in the gridview. </p>
  
  <p>The problem is in gridview when i attached image url of image control to code-<code>'&lt;%#"InsertProd.aspx.cs?path" %&gt;'</code> is not working as it's giving me null images/broken image link. </p>
  
  <p>is my method of binding the path upon dr.read to the imageURL in gridview wrong??
  i have edited my code behind page as below and design aspx page as bottom. </p>
  
  <p>the code for designer page is located below underneath,upon scroll down. thank you.</p>
  
  <pre><code>    protected void gvShowInsert_SelectedIndexChanged(object sender, EventArgs e)
      {
          SqlCommand cmd = new SqlCommand("SELECT product_cakeName, product_price,      
          product_qty,product_desc,product_img FROM Tbl_Products", conn);
  
          conn.Open();
  
          SqlDataReader dr;
          dr = cmd.ExecuteReader();
          if(dr.Read())
          {
             //Context.Response.BinaryWrite((byte[])dr[dr.GetOrdinal("product_img")]);
  
  
            byte[] path = (byte[])dr["product_img"]; //read the path of image
  
          }//imageControl.ImageUrl = path; //set the path to image control
  
  
          gvShowInsert.DataSource = dr;
          gvShowInsert.DataBind();
          dr.Close();
          conn.Close();
      }
  </code></pre>
  
  <p>this is my design aspx:</p>
  
  <pre><code>&lt;Columns&gt;
     &lt;asp:TemplateField HeaderText="cake-name"&gt;
         &lt;ItemTemplate&gt;
              &lt;asp:Label ID="lblHeaderName"   
              runat="server"Text='&lt;%#Eval("product_cakeName") %&gt;'&gt;&lt;/asp:Label&gt;    
         &lt;/ItemTemplate&gt;
    &lt;/asp:TemplateField&gt;
   &lt;asp:TemplateField HeaderText="price"&gt;
     &lt;ItemTemplate&gt;
     &lt;asp:Label ID="lblHeaderPrice" runat="server" Text='&lt;%#Eval("product_price")  
             %&gt;'&gt;&lt;/asp:Label&gt;    
      &lt;/ItemTemplate&gt;
   &lt;/asp:TemplateField&gt;
   &lt;asp:TemplateField HeaderText="qty"&gt;
   &lt;ItemTemplate&gt;
   &lt;asp:Label ID="lblHeaderQty" runat="server" Text='&lt;%#Eval("product_qty") %&gt;'&gt;&lt;/asp:Label&gt;    
   &lt;/ItemTemplate&gt;
   &lt;/asp:TemplateField&gt;
   &lt;asp:TemplateField HeaderText="desc"&gt;
   &lt;ItemTemplate&gt;
   &lt;asp:Label ID="lblHeaderDesc" runat="server" Text='&lt;%#Eval("product_desc") %&gt;'&gt;
   &lt;/asp:Label&gt;    
   &lt;/ItemTemplate&gt;
   &lt;/asp:TemplateField&gt;
   &lt;asp:TemplateField HeaderText="img"&gt;
   &lt;ItemTemplate&gt;
  &lt;asp:Image ID="imageControl" runat="server" ImageUrl='&lt;%#"InsertProd.aspx.cs?path" %&gt;' &gt;
  &lt;/asp:Image&gt;    
  &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  &lt;/Columns&gt;
  </code></pre>