0
我是.Net的新手。我想知道如何获取单元格的索引,就像访问GridView后获取一行的行索引一样。GridView单元格的单元格索引
我是.Net的新手。我想知道如何获取单元格的索引,就像访问GridView后获取一行的行索引一样。GridView单元格的单元格索引
通过获取对该行的引用并遍历其单元格来访问单元格。
说,例如,你正在处理的RowDataBound事件,你这是怎么进入细胞:
protected void CustomersGridView_RowDataBound(Object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
//e.Row.RowIndex will tell you the current row index
foreach (TableCell cell in e.Row.Cells)
{
//do something with the cell
}
}
}
你行索引的方式相同。 – adatapost