title: How to add <span> tag during runtime in C#
body: <p>In my website I am having 2 tables - album and images. </p>
  
  <blockquote>
    <p>album contains aid, alname. similarly image contains - imgid, imgname,
    imgurl, imgdes and aid [Foreign Key].</p>
  </blockquote>
  
  <p>This is my gallery.aspx page:</p>
  
  <pre><code>&lt;body style="background-image:url('Images/Backgrounds/back.jpg')"&gt;
      &lt;form id="form1" runat="server"&gt;
          &lt;h1 style="color:White"&gt;&lt;i&gt;Gallery - Albums&lt;/i&gt;&lt;/h1&gt;
          &lt;div id="container" runat="server" style="border-style:ridge; border-color:dimgrey; height:565px; padding-left:50px;padding-right:30px;padding-top:20px;padding-bottom:20px;"&gt;&lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>and this is my code-behind:</p>
  
  <pre><code>con.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
  con.Open();
  com = new SqlCommand("select * from album", con);
  reader = com.ExecuteReader();
  
  DataTable dtnew = new DataTable();
  dtnew.Load(reader);
  DataTable[] dt = new DataTable[6];
  con.Close();
  if (dtnew.Rows.Count &gt; 0)
  {
      for (int i = 0; i &lt; dtnew.Rows.Count; i++)
      {
          con.Open();
  
          int id = Convert.ToInt32(dtnew.Rows[i]["aid"]);
          DataTable dttemp = new DataTable();
          SqlCommand com1 = new SqlCommand("select * from image where aid=" + id + " ORDER BY aid desc", con);
          SqlDataReader dr = com1.ExecuteReader();
          dttemp.Load(dr);
          dt[i] = dttemp;
          ImageButton img = new ImageButton();
          img.ImageUrl = Convert.ToString(dt[i].Rows[0]["imgurl"]);
          img.ID = Convert.ToString(dtnew.Rows[i]["aid"]);
          img.Click += new ImageClickEventHandler(Img1_Click);
          img.AlternateText = Convert.ToString(dtnew.Rows[i]["alname"]);
          img.ToolTip = Convert.ToString(dtnew.Rows[i]["alname"]);
          img.CssClass = "galimg";
  
          con.Close();
  
          container.Controls.Add(img);
      }
  }
  </code></pre>
  
  <p>This code only loads 1st image in the Image Button and shows it as Album and when clicked it will be loading another page where all the images relating to that album.</p>
  
  <p>This is how it looks now:</p>
  
  <p><img src="https://i.stack.imgur.com/vPKhQ.png" alt="enter image description here"></p>
  
  <p>What I want now is I jus want a span or section of div to be added alongwith each imagebutton in the loop. so that this imagebutton will have some background with width and height greater than the Image button.. How can I achieve this. </p>
  
  <p>How can I do this in runtime?</p>