我想修改gridview某一列的值,代码如下:
for (int i = 0; i < 5; i++)
{
gv.Rows[i].Cells[3].Text= "aaa";
}
总是提示错误:索引超出范围。
DataKeyNames也设置为ID了
for (int i = 0; i < 5; i++)
{
gv.Rows[i].Cells[3].Text= "aaa";
}
总是提示错误:索引超出范围。
DataKeyNames也设置为ID了
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex > -1)
e.Row.Cells[3].TemplateControl = "aaa";
}