如何动态创建Html表,哪些具有多个单元格和单元格中的值将来自Asp.Net中的数据库#? [英] How Do I Create Html Table Dynamically,Which Having Multiple Cells And Value In The Cell Will Come From Database In Asp.Net #?

查看:58
本文介绍了如何动态创建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>"));


这篇关于如何动态创建Html表,哪些具有多个单元格和单元格中的值将来自Asp.Net中的数据库#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆