求一段代码 DataGrid的第一列既是选择列又是序号列的代码解决办法
求一段代码 DataGrid的第一列既是选择列又是序号列的代码
求一段代码 DataGrid的第一列既是选择列又是序号列的代码
------解决方案--------------------
只需要在你的Gridview的Databound中加上
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[1].Text = (e.Row.DataItemIndex + 1).ToString();
}
求一段代码 DataGrid的第一列既是选择列又是序号列的代码
------解决方案--------------------
只需要在你的Gridview的Databound中加上
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[1].Text = (e.Row.DataItemIndex + 1).ToString();
}