Hi I am working on a page which requires the grid to be populated with 'n' number of rows, as the user enters the number 'n' in a text box.
Can anyone help me out in this?
Hi I am working on a page which requires the grid to be populated with 'n' number of rows, as the user enters the number 'n' in a text box.
Can anyone help me out in this?
Use
for (int i = 0; i < n; i++)
{
dataGridview.Rows.Add();
}
to add n rows to your DataGridView
Did you mean DataGridView in C# windows based applications or GridView in ASP.NET ?
Basically you will have to create a DataTable, and work on that. The datatable would have the same columns as your grid view. you can add new rows, and data accordingly to this DataTable, and finally you will have to set the datasource for the gridView as this datatable you have created.
Have a read through this article:
thanks a lot.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.