0

c#

 for(int k = 0; k < tableAppointment.Rows[0].Cells.Count; k++)
            {
                cellID = tableAppointment.Rows[0].Cells[k];
    }

aspx

<table id="tableAppointment" runat="server">
        <tr Class="csstextheader">
            <td class="csstextheader" width="70px">
                                        </td>
            <td class="csstextheader" width="70px">
                                            <b>Time Slot&nbsp;</b>
                                        </td>
            <td ID="9"><span>C</span></td>

        </tr>
</table>

セル ID を取得するにはどうすればよいですか?

4

1 に答える 1

1

これを試して

 for(int k = 0; k < tableAppointment.Rows[0].Cells.Count; k++)
 {
     var currentCell = tableAppointment.Rows[0].Cells[k];
     string ID = currentCell.Attributes["ID"]; //for this, k must be count-1, the last cell
 }

ID を使用してセルを決定します。たとえば、最後のセルです。tableAppointment.Rows[0].Cells[2] or tableAppointment.Rows[0].Cells[Count-1]

于 2012-10-25T09:25:16.847 に答える