Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我如何重复a<;tr>;在c#中列出一个列表?_C#_Asp.net_.net - Fatal编程技术网

我如何重复a<;tr>;在c#中列出一个列表?

我如何重复a<;tr>;在c#中列出一个列表?,c#,asp.net,.net,C#,Asp.net,.net,我想用电脑列一张清单 这是我在listOfPeople.aspx上的代码: <table id="listOfPeople" runat="server"> <tr id="rowOfPerson" runat="server"> <td id="person" runat="server">name of a person</td> </tr> </table> 人名 我想重复一下通过c#创建人员列表的步骤: 柏

我想用电脑列一张清单

这是我在listOfPeople.aspx上的代码:

<table id="listOfPeople" runat="server">
<tr id="rowOfPerson" runat="server">
 <td id="person" runat="server">name of a person</td>
</tr>
</table>

人名
我想重复一下通过c#创建人员列表的步骤:


柏尔
杰森·麦克阿利斯特
马修·安德森

我可以在listoperson.aspx.cs上看到“rowOfPerson”,但我不知道如何创建新行。谢谢。

删除aspx中的表格html。 在aspx.cs中,编写整个表(包括所有需要的行),以便根据数据源动态呈现。
这只是众多方法中的一种,但我相信这是实现这一目标最简单、最快捷的方法。

有多种方法

将此html置于repeater控件中,并为其分配数据源

<tr id="rowOfPerson" runat="server">
 <td id="person" runat="server">name of a person</td>
</tr>

人名

使用任何其他方式,如添加带有runat server属性的表。。。循环代码中的数据并为您的数据添加该表的tr…

您是否要求有人编写C#代码来执行此操作?Google“aspx repeat”,获得第三个点击率…可能重复使用asp:Repeater,在ItemTemplate中绑定您的姓名,页眉模板中的表格打开标记和页脚模板中的表格关闭标记。
用于表格数据<代码>
    用于列表。使用HTML元素实现其目的。
    <tr id="rowOfPerson" runat="server">
     <td id="person" runat="server">name of a person</td>
    </tr>