How to add new row in datagrid

cheena

Newcomer
Joined
Nov 11, 2003
Messages
14
Hai
problem add new row in datagrid

when i click the button it should add a new row in datagrid,is it possible,if how to do.

thanks in advance

cheena
 
u can add a row to the datatable ur binding ur grid to the changes will be reflected in the grid
 
hi, cheena try this code

private yourControl_Click()
{
BoundColumn hplarea;
hplarea = new BoundColumn();


hplarea.HeaderText = "new column";
hplarea.DataField = "new field";
hplarea.Visible = false;
SearchByAreaDataGrid.Columns.Add(hplarea);

da = new SqlDataAdapter("SELECT newfield FROM yourTable",_conStr);
Store = new DataSet();
da.Fill(Store);
DataGrid1.DataSource = store;
DataGrid1.DataBind();
}
 
Back
Top