简体   繁体   English

Gridview:内部网格的行号

[英]Gridview : Row number for Inner grid

In my page im using gridview to display records. 在我的页面上,我使用gridview来显示记录。 Each row having record in the inner grid. 每行在内部网格中都有记录。 i want to display row number for the inner grid, for each row inner grid row number should start with 1.pls help me 我想显示内部网格的行号,对于每一行内部网格的行号应以1.pls开头

It's a Web application (.NET 2008 , .NET 3.5 + C#) 这是一个Web应用程序(.NET 2008,.NET 3.5 + C#)

DataGridViewTextBoxCell newCell = new DataGridViewTextBoxCell();
DataGridViewColumn SNOCol = new DataGridViewColumn(newCell);
SNOCol.DisplayIndex = 0;
SNOCol.HeaderText = "SNO";
SNOCol.Name = "SNO";
DataGridView1.Columns.Add(SNOCol);

int cnt = DataGridView1.Rows.Count;
int i;
for (i = 1; i <= cnt; i++)
{
DataGridView1.Rows[i - 1].Cells["SNO"].Value = i;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM