Hi everyone. We have a child grid that is bound to data as requested. We have added a GridViewCheckBoxColumn to the row, but we can't seem to edit it?
Here we set the child element:
grdCustomers.DataSource = contact.GetList(
true
, 0);
grdCustomers.Templates.Add(CreateChildTemplate());
private
GridViewTemplate CreateChildTemplate()
{
var template =
new
GridViewTemplate();
template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
template.AllowEditRow =
true
;
template.ReadOnly =
false
;
var select =
new
GridViewCheckBoxColumn(
"CheckBox"
);
var field1 =
new
GridViewTextBoxColumn(
"Field1"
);
var field2 =
new
GridViewTextBoxColumn(
"Field1"
);
select.ReadOnly =
false
;
select.DataType =
typeof
(
bool
);
select.EditMode = EditMode.OnValueChange;
template.Columns.AddRange(select, field1, field2);
return
template;
}
Then we bind the data to the child grid
var row = e.Template.Rows.NewRow();
row.Cells[
"Field1"
].Value = dataRow.Field1;
row.Cells[
"Field2"
].Value = dataRow.Field2;
row.Cells[
"Select"
].Value = dataRow.Select;
row.Cells[
"Select"
].ReadOnly =
false
;
e.SourceCollection.Add(row);
No watter what we have tried, we can't get the checkbox to be editable?
Please advise.
Thank you.