Question

How to Add a new row to a DATAGRIDVIEW in ASP.NET....using c# Code ???

Was it helpful?

Solution

As far as I am aware you can't do it directly from code. An easier way is to set up a data source with the rows you require.

List<string> myDatasource = new List<string>();
myDataSource.Add("New Row 1");
myDataSource.Add("New Row 2");

dataGridView1.DataSource = myDataSource;
dataGridView1.DataBind();

Are you using data binding already?

OTHER TIPS

use DataGridView1.Columns.Add();

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top