hi everybody,
iam new to dotnet..
iam trying to give table as the datasource to the datagrid ,but iam getting an error like object ref.is not set to instance of an object...at the line r=dt.NewRow();
and i have no bound columns in my datagrid.my intension is to add the data entered in the textboxes to the grid though the datatable;
what is the error in my code.........
please help me..
protected DataTable dt = new DataTable();
DataRow r;
r = dt.NewRow();
r[0] = TextBox1.Text;
r[1] = TextBox2.Text;
r[2] = TextBox3.Text;
int i = DataGrid1.Items .Count;
dt.Rows.InsertA t (r,i );
dt.AcceptChange s();
dt.GetChanges() ;
DataGrid1.DataS ource = dt;
DataGrid1.DataB ind();
iam new to dotnet..
iam trying to give table as the datasource to the datagrid ,but iam getting an error like object ref.is not set to instance of an object...at the line r=dt.NewRow();
and i have no bound columns in my datagrid.my intension is to add the data entered in the textboxes to the grid though the datatable;
what is the error in my code.........
please help me..
protected DataTable dt = new DataTable();
DataRow r;
r = dt.NewRow();
r[0] = TextBox1.Text;
r[1] = TextBox2.Text;
r[2] = TextBox3.Text;
int i = DataGrid1.Items .Count;
dt.Rows.InsertA t (r,i );
dt.AcceptChange s();
dt.GetChanges() ;
DataGrid1.DataS ource = dt;
DataGrid1.DataB ind();
Comment