简体   繁体   中英

Gridview : Row number for Inner grid

In my page im using gridview to display records. 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

It's a Web application (.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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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