I have a table layout on my Form in which I use a Datagrid to show the data. The first time when I assign a datasource to it, it works well, but when I assign a Datasource to the DataGrid a second time, it doesn't call the RowsAdded event of Datagrid and Datagrid doesn't show anything except its header and Datagrid shows the RowCount
is 0.
I found a similar problem here also:
Datagridview rowcount showing 0 even when there is a valid datasource
EDIT #1
My code is
gridProjectEdit.DataSource = null;
gridProjectEdit.Columns.Clear();
gridProjectEdit.Rows.Clear();
gridProjectEdit.Refresh();
if(dt!=null)
dt.Clear();
dt=methodCaller.GetProjectData(); //get the data
gridProjectEdit.DataSource = dt; //copying datatable