Hi, when I click on btnTest button to add a column to my datatable, I receive this error message:
"Collection is read-only."
Could you help me plese? Below you can see my snipped code.
Thanks
DataTable dt = null ;
public ucTab01()
{
InitializeComponent();
GetDT();
}
void
GetDT()
{
dt = new DataTable();
dt.Columns.Add(new DataColumn() { ColumnName = "Col1", DataType = typeof(string) });
DataRow row = dt.NewRow();
row["Col1"] = "test";
dt.Rows.Add(row);
this.RadGridView01.ItemsSource = dt.ToList();
}
private void btnTest_Click(object sender, RoutedEventArgs
new DataColumn() { ColumnName = "Col2", DataType = typeof(decimal
) }); //This is my ERROR!
}