Asp.net 循环遍历TableRow.Cells
假设我有一张这样的桌子:Asp.net 循环遍历TableRow.Cells,asp.net,vb.net,Asp.net,Vb.net,假设我有一张这样的桌子: <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>TableCell Example</title> </head> <body> <form id="form1" runat="server"> <div> <h1&
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>TableCell Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>TableCell Example</h1>
<asp:table id="Table1" runat="server"
CellPadding="3" CellSpacing="3"
Gridlines="both">
<asp:TableRow>
<asp:TableCell Text="(0,0)" />
<asp:TableCell Text="(0,1)" />
<asp:TableCell Text="(0,2)" />
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="(1,0)" />
<asp:TableCell Text="(1,1)" />
<asp:TableCell Text="(1,2)" />
</asp:TableRow>
</asp:table>
</div>
</form>
</body>
</html>
For Each row As TableRow In objTable.Rows
'How do I get the value of a cell here by ID?
Next
是否可以通过索引获取单元格值?使用名为的属性。从MSDN: 获取表示表控件中行的单元格的TableCell对象的集合 此属性返回的集合是一个名为的类的实例,该类具有一些必需的方法和属性,例如通过其索引获取表单元格对象 此外,您还可以使用
foreach
循环获取集合中的每一行,就像您对行所做的那样
要获取
表格单元格的文本,您只需使用其名为。。。等等 是的,但我正在尝试获取单元格值。你能通过索引得到单元格值吗?