title: How To Create TextBox Control Dynamically at Runtime/ problems with .cs
body: <p>This page is to retrieve data and display in the page and enable user to edit the info.</p>
  
  <p>at this moment i need to retrieve the data and display it in textbox.</p>
  
  <p>as i also have to retrieve multiple data from data and display on each different text box.</p>
  
  <p>my .cs code is as follows:</p>
  
  <pre><code>foreach (DataRow dr in ChildImageDT.Rows)
  {
    myImage = new Images();
    myImage.DateTaken = DateTime.Parse(dr["image_taken_dt"].ToString());
    myImage.PlaceTaken = dr["image_taken_loc"].ToString();
    myImage.DetailedInfo = dr["image_info"].ToString();
  
    tableString += "&lt;tr&gt;&lt;td&gt;Date Taken:&lt;/td&gt;";
    tableString += "&lt;td&gt;&lt;asp:TextBox ID=\"txtDateOfBirth\"&gt;" + myImage.DateTaken + "&lt;/asp:TextBox&gt;";
    tableString += "&lt;asp:CalendarExtender ID=\"CalendarExtender1\" runat=\"server\" CssClass=\"AjaxCalendar\"";
    tableString += "PopupButtonID=\"imgCalendar\" PopupPosition=\"Right\" TargetControlID=\"txtDateOfBirth\" Format=\"MM/dd/yyyy\"&gt;&lt;/asp:CalendarExtender&gt;";
    **tableString += "&lt;asp:TextBoxWatermarkExtender ID=\"TextBoxWatermarkExtender1\" runat=\"server\" TargetControlID=\"txtDateOfBirth\" WatermarkText=\"Month/Day/Year\" WatermarkCssClass=\"watermarked\"&gt;&lt;/asp:TextBoxWatermarkExtender&gt;";**
    tableString += "&lt;asp:Image ID=\"imgCalendar\" runat=\"server\" ImageUrl=\"img/Button/calendar.png\" Width=\"20px\" /&gt;&lt;/td&gt;";
    **tableString += "&lt;td rowspan=3 &gt;&lt;input type=\"button\" class=\"right_content\" title=\"" + " " + "\"";
    tableString += "onClick =\"location.href='ViewProfile.aspx?cid=" + "" + "'\" ";
    tableString += "style=\"background-size:100%; background:url('/img/missing%20children%20pictures/";**
    tableString += "" + ".jpg')\"/&gt;&lt;/td&gt;&lt;/tr&gt;";
    tableString += "&lt;tr&gt;&lt;td&gt;Place Taken:&lt;/td&gt;";
    **tableString += "&lt;td&gt;" + textbox1.Text = myImage.PlaceTaken;**
    tableString += "&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;";
    tableString += "&lt;tr&gt;&lt;td rowspan=3&gt;Detailed Info:&lt;/td&gt;";
    tableString += "&lt;td rowspan=3&gt;&lt;input id=\"txtImageDetailedInfo\" type=\"text\"&gt;" + myImage.DetailedInfo + "&lt;/input&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;";
    tableString += "&lt;tr&gt;&lt;td&gt;&lt;input id=\"SetProfilePicture\" type=\"radio\" /&gt;&lt;/td&gt;&lt;/tr&gt;";
    tableString += "&lt;tr&gt;&lt;td&gt;&lt;input id=\"DeletePhoto\" type=\"checkbox\" /&gt;&lt;/td&gt;&lt;/tr&gt;";
  }
  </code></pre>
  
  <p>the page should look like this :
  where each photo as it own description and i need to retrieve all the images and data from 
  <img src="https://i.stack.imgur.com/WuEZm.png" alt="Screenshot"></p>