lundi 11 mai 2015

Loop through TableRow.Cells

Say I have a table like this:

<html xmlns="http://ift.tt/lH0Osb" >
<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>

How can I get the value of a cell in code. Something like this:

For Each row As TableRow In objTable.Rows
  'How do I get the value of a cell here by ID?
Next

Can you get a cell value by index?

Aucun commentaire:

Enregistrer un commentaire