I have a division structured like this:
<div style="border:0px solid #ff0000;width:60%;margin: 0 auto;">
<div class="div_container" style="width:100%;border:1px solid #ff0000;" id="div_dynamic_table" runat="server">
<!--<div class="box" style="border:1px solid #ff0000;" runat="server">
<table id="id_dynamic_table" runat="server" class="table">
<tr>
<td>
sample
</td>
<td>
<input name="txtuname2" type="text" id="txtuname2" class="form-control" runat="server" />
</td>
</tr>
</table>
</div>-->
</div>
</div>
My code behind includes the following:
sbTable.Append("<table class='table'>");
sbTable.Append("<tr><td style='white-space:nowrap'> sample Message td </ td>");
sbTable.Append("<td> <input name='txtuname' type='text' id='txtuname' class='form-control' runat='server' /> </ td> ");
sbTable.Append("</ tr>");
sbTable.Append("</ table>");
div_dynamic_table.InnerHtml = sbTable.ToString();
Upon running the code, I get a result as shown in this image.
The issue I am facing is that the input box is not contained within the div element as expected.
If I uncomment the table section in my HTML code, everything works fine and the input box is enclosed within the div.
The reason for generating the table dynamically in the code behind is to ensure flexibility and efficiency.
It's worth mentioning that Bootstrap is being utilized in this context.
Any advice or suggestions would be greatly appreciated.