C# 想要有多行.net表吗
我想知道为什么.Net表行被添加到同一行而不是多行 具体而言,此代码存在问题:C# 想要有多行.net表吗,c#,.net,html-table,C#,.net,Html Table,我想知道为什么.Net表行被添加到同一行而不是多行 具体而言,此代码存在问题: this.table.Rows.AddAt(0,labels); this.table.Rows.AddAt(1,fields); this.table.Rows.AddAt(2,submits); 表是一个网络控件。表 标签、字段和提交是TableRows 这些都包括表格单元格 但当我在浏览器中查看它时,它表示为“所有行和列” 然后两个空的 标签 因此,它添加了所有单元格和行的内容,甚至添加了三行,但出于某种
this.table.Rows.AddAt(0,labels);
this.table.Rows.AddAt(1,fields);
this.table.Rows.AddAt(2,submits);
表是一个网络控件。表标签、字段和提交是TableRows
这些都包括表格单元格 但当我在浏览器中查看它时,它表示为“所有行和列” 然后两个空的
<table border="0">
<tr>
<td><span>please enter the title of the interaction here</span></td><td><span>please enter the description of the interaction here</span></td><td><span>please select the impact level of the interaction here</span></td><td><span>please select the urgency level of the interaction here</span></td><td><span>please enter the contact of the interaction here</span></td><td><input name="ctl00$PlaceHolderMain$ctl00$ctl06" type="text" value="one" /></td><td><input name="ctl00$PlaceHolderMain$ctl00$ctl07" type="text" value="two" /></td><td><select name="ctl00$PlaceHolderMain$ctl00$ctl08">
<option selected="selected" value="1">Low</option>
<option value="2">Medium</option>
<option value="3">High</option>
</select></td><td><select name="ctl00$PlaceHolderMain$ctl00$ctl09">
<option selected="selected" value="1">Low</option>
<option value="2">Medium</option>
<option value="3">High</option>
</select></td><td><input name="ctl00$PlaceHolderMain$ctl00$ctl10" type="text" value="con" /></td><td rowspan="3"><input type="submit" name="ctl00$PlaceHolderMain$ctl00$ctl11" value="Create Interaction" /></td><td rowspan="2"><span>No interactions created yet</span></td>
</tr><tr>
</tr><tr>
</tr>
</table>
请在此处输入互动的标题请在此处输入互动的描述请在此处选择互动的影响程度请在此处选择互动的紧急程度请在此处输入互动的联系人
低
中等
高
低
中等
高
尚未创建任何交互
您可以通过传递单元格容器来尝试使用此代码
/adding first row
TableRow row1 = new TableRow();
//adding first cell
TableCell cell1 = new TableCell();
//adding label
Label text1 = new Label();
text1.Text = "Just test";
cell1.Controls.Add(text1);
row1.Controls.Add(cell1);
table1.Controls.Add(row1);
你能展示一些生成的html吗?好的,谢谢。我不想把它作为一个答案,因为我不确定它是否正确,但如果我不得不猜测,我会说
AddAt
函数实际上并没有add
行添加到表中,只是将数据添加到现有行中。