المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Empty rows in daatagrid



C# Programming
01-18-2010, 01:50 PM
I have a datagrid binded to a datatable. I am filling the datatable for example with 4 rows. When i then try to show the datagrid rows in the windows form the the datagrid inserts 4 empty rows.
it point notmally to the datatable but the cell of the datagrid is empty. if i put let say 10 rows in table then again in the datagrid i see 10 rows but empty cells.

DataGridView1.AutoGenerateColumns = true;
DataGridView.DataSource =DT;


DataGridView1.Columns.Add("CCH_Index", "CCH_Index");
DataGridView1.Columns[0].DataPropertyName = "CCH_Index";
DataGridView1.Columns[0].ReadOnly = true;

this happens when i select particular rows from datasource to display;