Hello,
I have an radgridview that its bound to an datatable from code behind. From code I setup columns and from designer I have one checkbox column.
When I run the app and mark that checkbox column I want to change the text value of one of the other columns. But when I try to change the value of the other column it say "Column "name" its readonly." I check the status of the cell and its says readonly = false;
private void BindGrid()
{
var result = SqlClass.JT_Batch_GetBatches();
grid_Batch.MasterTemplate.AllowAddNewRow = false;
this.grid_Batch.AutoGenerateColumns = false;
this.grid_Batch.AllowEditRow = true;
this.grid_Batch.MasterTemplate.AllowAddNewRow = false;
this.grid_Batch.MasterTemplate.AutoGenerateColumns = false;
this.grid_Batch.MasterTemplate.AllowEditRow = true;
this.grid_Batch.MasterTemplate.AllowDeleteRow = false;
this.grid_Batch.MasterTemplate.AllowCellContextMenu = false;
this.grid_Batch.MasterTemplate.ShowFilterCellOperatorText = false;
this.grid_Batch.MasterTemplate.ShowHeaderCellButtons = true;
this.grid_Batch.MasterTemplate.EnableFiltering = false;
this.grid_Batch.EnableFiltering = true;
this.grid_Batch.MasterTemplate.ShowFilteringRow = false;
this.grid_Batch.TableElement.BeginUpdate();
try
{
using (SqlConnection conn = SqlClass.GetConnection())
{
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "GetBatches";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = conn;
SqlDataReader reader = cmd.ExecuteReader();
DataTable val = new DataTable();
val.Load(reader);
GridViewTextBoxColumn batch = new GridViewTextBoxColumn("Batch");
batch.Width = 161;
batch.ReadOnly = true;
grid_Batch.MasterTemplate.Columns.Add(batch);
GridViewTextBoxColumn comment = new GridViewTextBoxColumn("Comment");
comment.Width = 215;
comment.ReadOnly = true;
grid_Batch.MasterTemplate.Columns.Add(comment);
GridViewDateTimeColumn created = new GridViewDateTimeColumn("Created");
created.Width = 86;
created.ReadOnly = true;
grid_Batch.Columns.Add(created);
GridViewTextBoxColumn Frequency = new GridViewTextBoxColumn("Frequency");
Frequency.Width = 129;
Frequency.ReadOnly = true;
grid_Batch.MasterTemplate.Columns.Add(Frequency);
GridViewTextBoxColumn Status = new GridViewTextBoxColumn("Status");
Status.Width = 139;
Status.ReadOnly = false;
grid_Batch.Columns.Add(Status);
GridViewDecimalColumn tran = new GridViewDecimalColumn("# Tran.");
tran.Width = 60;
tran.ReadOnly = true;
grid_Batch.MasterTemplate.Columns.Add(tran);
GridViewDecimalColumn Total = new GridViewDecimalColumn("Total");
Total.Width = 82;
Total.ReadOnly = true;
Total.FormatString = "{0:$#,###0.00;($#,###0.00);0}";
grid_Batch.MasterTemplate.Columns.Add(Total);
GridViewTextBoxColumn SOURCDOC = new GridViewTextBoxColumn("SOURCDOC");
SOURCDOC.Width = 0;
SOURCDOC.ReadOnly = true;
SOURCDOC.IsVisible = false;
grid_Batch.MasterTemplate.Columns.Add(SOURCDOC);
this.grid_Batch.DataSource = val.DefaultView;
}
private void grid_Batch_CellEndEdit(object sender, GridViewCellEventArgs e)
{
if (e.Column.Name == "select")
{
var row = grid_Batch.CurrentRow.Cells;
GridViewCellInfo cell = row[5] as GridViewCellInfo;
if (bool.Parse(row["select"].Value.ToString()) == true)
cell.Value = "MArked"; //HERE I GET THE ERROR MESSAGE!!!!!!!!!
else
row[5].Value = "Available";
}
}
Thanks,
Ed