日期:2014-05-19  浏览次数:20748 次

请问DatagridBoolColumn列的一点小问题。
1.为什么DatagridBoolColumn列我绑定之后,默认都是选中的,这个怎么控制它根椐的我数据值来显示是否选中?
2.双击之后,可以将它改为不选。但只要我一点其它行,它又变成选中的,到底怎回事?怎么解决?

请指教,谢谢~

------解决方案--------------------
你代码怎么写的?应该没问题的啊
关键代码贴来看下吧
------解决方案--------------------
给里段代码参考下吧,呵呵

DataGridColumnStyle boolCol = new DataGridBoolColumn();
boolCol.MappingName = "Current ";
boolCol.HeaderText = "IsCurrent Customer ";
boolCol.Width = 150;
ts1.GridColumnStyles.Add(boolCol);

DataTable tCust = new DataTable( "Customers ");

// Create one column, and add it to the first table.

DataColumn cCurrent = new DataColumn( "Current ", typeof(bool));

tCust.Columns.Add(cCurrent);

// Add the tables to the DataSet.
myDataSet.Tables.Add(tCust);

myDataGrid.SetDataBinding(myDataSet, "Customers ");