IsSetData in gridcontrol is never true when clicking on checkEdit item
I have this DevExpress GridContro
l which I've added with two coloums the one containing a repositoryItemCheckEdit
and the other normal string
Category description.
Now I've made the repositoryItemCheckEdit
a unbound bool in the property section and added the gridView1_CustomUnboundColumnData
event which fires with e.IsGetData
true but the the e.IsSetData
is never true when I click on the check box. Can anyone explain why this is?
Thanks
private void gridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
{
if (e.IsGetData)
{
string itemKey = ((CategoryTable)(gridControl1.ViewCollection[0]).GetRow(e.RowHandle)).Category;
if (AddressDoc == itemKey) e.Value = true
else e.Value = false;
}
if (e.IsSetData)
Address开发者_如何转开发Doc = ((CategoryTable)(gridControl1.ViewCollection[0]).GetRow(e.RowHandle)).Category;
}
Please try the solution from the How to save the value of an in-place check box as soon as it is changed knowledge base article published on our web site. It should help you resolve this problem. Also, I have reviewed your code and it does not look to be safe. I would change it as follows:
private void gridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e) {
GridView gridView = sender as GridView;
DataView dv = gridView.DataSource;
object c = DataView[e.ListSourceRowIndex]["Category"];
string itemKey = c == null ? "" : c.ToString();
if (e.IsGetData) {
if(AddressDoc == itemKey)
e.Value = true;
else
e.Value = false;
}
if(e.IsSetData)
AddressDoc = itemKey;
}
I can only think that you did not properly adjusted the unbound column. NOTE: a column should meet two mandatory conditions to be unbound: 1) it's FieldName should be set to a unique value among fieldName properties of other GridView columns; 2) the column's UnboundType should be set to the non Bound value.
精彩评论