如何创建多个动态表

如何创建多个动态表

本文介绍了如何创建多个动态表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建多个动态表。我在网上看过使用中继器和我看过的例子,但这些例子总是涵盖一个表。我需要创建MULTIPLE。例如:



I need to create multiple dynamic tables. I've looked online about using repeaters and I've seen examples, but these examples cover always ONE table. I need to create MULTIPLE ones. For instance:

<table>
    <tr>
        <td colspan="4" style="width: 200px; font-weight: bold, font-size: xxx; etc etc">
              HTML blah blah blah
        </td>
    </tr>
    <tr>
        <td>HTML</td>
       <td>LABEL CONTROL - basicallly a label control rendering data</td>
       <td>HTML</td>
       <td>LABEL CONTROL - bascially a label control rendering data</td>
     </tr>
     <tr>
         <td colspan="2">
         </td>
         <td colspan="2">
         </td>
     </tr>
       .
       .
       .
</table>





然后,我需要创建第二个表,可能是第三个,第四个,或第十个,等等。我走了这个?数据将来自Sharepoint List项目。我还需要为表格和TD添加样式。表中的任何按钮或数据都不会被用户更改...基本上,表格只会显示数据。



提前致谢。



我尝试了什么:



我读过有关使用中继器的信息,但是中继器我已经阅读过关于创建动态行和tablecells的内容,而不是表本身。



Then, I would need to create a second table, maybe a third, or fourth, or tenth, etc. How do I go about this? The data would be coming from a Sharepoint List item. I will also need to add style to the table and TDs. No buttons or data within the table will be changed by the user... basically, the table will only display data.

Thanks in advance.

What I have tried:

I've read about repeaters being used, but repeaters I've read about only cover creating dynamic rows and tablecells, not tables themselves.

推荐答案

DataTable dt = new DataTable();
dt.Columns.Add("Id");
dt.Columns.Add("Name");
dt.Columns.Add("Email");
dt.TableName = "MasterTable";

//insert into DataTable
dt.Rows.Add("1", "test1", "[email protected]");
dt.Rows.Add("2", "test2", "[email protected]");
dt.Rows.Add("3", "test3", "[email protected]");

//Creating another DataTable to copy
DataTable dt_copy = new DataTable();
dt.TableName = "CopyTable";
dt_copy = dt.Copy();


这篇关于如何创建多个动态表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 23:16