AD
Administrator
Syncfusion Team
January 31, 2007 09:51 PM UTC
Hi Srdjan,
You can handle the SourceListRecordChanged event of the grid and set the value of the column using the e.Record.SetValue method. Try the below code snippet and let me know if you are looking something different.
private void gridGroupingControl1_SourceListRecordChanged(object sender, RecordChangedEventArgs e)
{
if( e.Action == RecordChangedType.Added )
e.Record.SetValue("ColumnName",DBNull.Value);
}
Best Regards,
Haneef
AD
Administrator
Syncfusion Team
February 1, 2007 08:52 AM UTC
Thanks for your answer however it doesn't work. Your code is giving me following exception:
NotSupportedException: Id is read-only.
I'am using MS SQL database and Id is configured as int identity.
AD
Administrator
Syncfusion Team
February 6, 2007 12:11 AM UTC
Hi ,
Before changing the cell value of the readonly column, You should change the Readonly property of the datacolumn to false. Here is a code snippet
private void gridGroupingControl1_SourceListRecordChanged(object sender, Syncfusion.Grouping.RecordChangedEventArgs e)
{
if( e.Action == RecordChangedType.Added )
{
DataTable dt = this.gridGroupingControl1.DataSource as DataTable;
dt.Columns["ID"].ReadOnly = false;
DataRowView row = e.Record.GetData() as DataRowView;
row.Row[0]= DBNull.Value ;
dt.Columns["ID"].ReadOnly = true;
}
}
Best regards,
Haneef
AD
Administrator
Syncfusion Team
February 6, 2007 12:12 AM UTC
Hi ,
Before changing the cell value of the readonly column, You should change the Readonly property of the datacolumn to false. Here is a code snippet
private void gridGroupingControl1_SourceListRecordChanged(object sender, Syncfusion.Grouping.RecordChangedEventArgs e)
{
if( e.Action == RecordChangedType.Added )
{
DataTable dt = this.gridGroupingControl1.DataSource as DataTable;
dt.Columns["ID"].ReadOnly = false;
DataRowView row = e.Record.GetData() as DataRowView;
row.Row[0]= DBNull.Value ;
dt.Columns["ID"].ReadOnly = true;
}
}
Best regards,
Haneef