title: Adding an image <img src=“?”> dynamically in asp.net c#
body: <p>I have a book database where i have book information. I have a row where i store the name of the picture of the book i want to display on the page. For example cprog.jpeg</p>
  
  <p>Now, i want to append that name to the src to display the picture. However, its just displaying the name itself. Im not quite sure how to do it. </p>
  
  <pre><code> + " &lt;img src=\"{0} \"&gt;" + row[8].ToString() + "&lt;/div&gt;"
  </code></pre>
  
  <p>Here is the complete code..</p>
  
  <pre><code>foreach (DataTable table in dsgrid2.Tables)
              {
                  foreach (DataRow row in table.Rows)
                  {
                      strBooksInCategory +=
                            "&lt;div style=\"height:150px;\"&gt;"
  
                            + " &lt;img src=\"{0} \"&gt;" + row[8].ToString() + "&lt;/div&gt;"
                          + "  &lt;div style=\"height:110px;float:left;padding-left:10px;\"&gt;"
                          + "   &lt;div style=\"height=auto;left-margin:10px;\"&gt;" + row[0] + "&lt;/div&gt;"
                          + "   &lt;div style=\"height=auto;left-margin:10px;\"&gt;" + row[1] + "&lt;/div&gt;"
                          + "   &lt;div style=\"height=auto;left-margin:10px;\"&gt;" + row[2] + "&lt;/div&gt;"
                          + "   &lt;div style=\"height=auto;left-margin:10px;\"&gt;" + row[3] + "&lt;/div&gt;"
                          + "   &lt;div style=\"height=auto;left-margin:10px;\"&gt;" + row[4] + "&lt;/div&gt;"
                          + "   &lt;div style=\"height=auto;left-margin:10px;\"&gt;" + row[5] + "&lt;/div&gt;"
                          + " &lt;/div&gt;"
                          + "&lt;/div&gt;";
                      strBooksInCategory += "&lt;div style=\"height:10px;width=100%;\"&gt;&lt;/div&gt;";
  </code></pre>