title: Display binary image without using generic http handler
body: <p>I have to display student name and image on my web page while selecting student id from the drop down list. The image is stored in var binary format on db. How can I retrieve the image and display on image box. The given below code is only shows the student first name and last name. How can I display the image without using http generic handler page? Please help me.</p>
  
  <p>Code:</p>
  
  <pre><code>protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
      {
          DataSet1TableAdapters.TextBoxTableTableAdapter tx;
          tx = new DataSet1TableAdapters.TextBoxTableTableAdapter();
          DataTable dt = new DataTable();
          dt = tx.GetstudData(int.Parse(DropDownList1.SelectedValue));
  
          foreach (DataRow row in dt.Rows)
          {
              TextBox1.Text = (row["FirstName"].ToString());
              TextBox2.Text = (row["SecondName"].ToString());
          }
      }
  </code></pre>
  
  <p>SQL Query:</p>
  
  <pre><code>SELECT FirstName, SecondName, StudentImage FROM TextBoxTable WHERE (Id = @Id)
  </code></pre>
  
  <p>Aspx Source:</p>
  
  <pre><code>&lt;div&gt;
  &lt;asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"&gt;
  &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt;
  &lt;asp:TextBox ID="TextBox2" runat="server"&gt;&lt;/asp:TextBox&gt;
  &lt;asp:Image ID="Image1" runat="server" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Data Base:</p>
  
  <p><img src="https://i.stack.imgur.com/xdVrl.jpg" alt="enter image description here"></p>