如何动态创建Html表,哪些具有多个单元格和单元格中的值将来自Asp.Net中的数据库#?

问题描述:

我有问题要生成html表,

哪个有多个单元格,而单元格值的
将来自asp.net c#中的数据库?

i having the problem to generate the html table,
which have multiple cells and
in the value of the cell will come from database in asp.net c#?

请试试这个



http://www.dotnetfunda.com/Blogs/Venkyshwe8%40gmail.com/1264/显示表信息 - 动态 - 不使用任何控件 [ ^ ]



全部如果你需要更多的支持,请写回来。
pls try this

http://www.dotnetfunda.com/Blogs/Venkyshwe8%40gmail.com/1264/displaying-a-table-information-dynamically-without-using-any-controls[^]

All the best :) write back if you need more support.


ASPX

------------------ --------------

ASPX
--------------------------------
<div runat="server" id="div_msg_group">
                            </div>













CS

--------------------------- ---







CS
------------------------------

div_msg_group.Controls.Add(new LiteralControl("<table border="0" width="800px" id="tb_sub2" cellpadding="0" cellspacing="0" style="font-size:17px;">"));
                                 div_msg_group.Controls.Add(new LiteralControl("<tr>"));
                                 div_msg_group.Controls.Add(new LiteralControl("<td colspan="2" style="color:#2175CE; text-decoration:underline;">Record not saved some problem here .....!!!!!!!!!</td>"));
                                 div_msg_group.Controls.Add(new LiteralControl("</tr>"));
                                 foreach (DataRow dr in dtmsg.Rows)
                                 {
                                     int total_row = Handle.ToInt32((dtmsg.Rows.Count));
                                     int j = 0;
                                     div_msg_group.Controls.Add(new LiteralControl("<tr>"));
                                     div_msg_group.Controls.Add(new LiteralControl("<td style="color:red; Font-size:12px;">  " + Handle.ToString(dr["student_name"]) + "</td>"));
                                     div_msg_group.Controls.Add(new LiteralControl("<td style="color:red; Font-size:12px;">  " + Handle.ToString(dr["combinaiton_code"]) + "</td>"));
                                     div_msg_group.Controls.Add(new LiteralControl("</tr>"));
                                 }
                                 div_msg_group.Controls.Add(new LiteralControl("</table>"));