this.gridDataBoundGrid1.DataSource = null;
this.categoriesTableAdapter.Fill(this.northwindDataSet.Categories);
this.gridDataBoundGrid1.DataSource = this.bindingSource1;
this.gridDataBoundGrid1.DataMember = "Categories";
You can use the Binder.RemoverRecords method to delete rows.
DataTable table = (DataTable) gridDataBoundGrid1.DataSource;
int curRowIndex = gridDataBoundGrid1.CurrentCell.RowIndex;
if (gridDataBoundGrid1.Model.RowCount > 1 && curRowIndex > 0&& gridDataBoundGrid1.Model.RowCount > curRowIndex )
{
int recNumber = this.gridDataBoundGrid1.Binder.RowIndexToPositioncurRowIndex);
this.gridDataBoundGrid1.Binder.RemoveRecords(recNumber, recNumber);
}
else
{
Console.WriteLine("No More rows / CurCell is not set");
}
}
Kindly let us know if you need any further assistance.
Best Regards,
Jeba.
this.gridDataBoundGrid1.DataSource = null;
this.categoriesTableAdapter.Fill(this.northwindDataSet.Categories);
this.gridDataBoundGrid1.DataSource = this.bindingSource1;
this.gridDataBoundGrid1.DataMember = "Categories";
You can use the Binder.RemoverRecords method to delete rows.
DataTable table = (DataTable) gridDataBoundGrid1.DataSource;
int curRowIndex = gridDataBoundGrid1.CurrentCell.RowIndex;
if (gridDataBoundGrid1.Model.RowCount > 1 && curRowIndex > 0&& gridDataBoundGrid1.Model.RowCount > curRowIndex )
{
int recNumber = this.gridDataBoundGrid1.Binder.RowIndexToPositioncurRowIndex);
this.gridDataBoundGrid1.Binder.RemoveRecords(recNumber, recNumber);
}
else
{
Console.WriteLine("No More rows / CurCell is not set");
}
}
Kindly let us know if you need any further assistance.
Best Regards,
Jeba.
hi there..
i am using c#.net 2003 where i could not find DataGrid.Binder and DataGrid.Model classes..can u plz help me what is the problem should i add any classes in header or any other solution..i would appreciate if u can write me code for Editing and Modifying a record in DataGrid also?
thanking you
mady