===========================================
还有,请问怎样才能在DataGrid每行前面加上CheckBoxes?就像listView中设置了CheckBoxes一样
===========================================
还有,请问怎样才能在DataGrid每行前面加上CheckBoxes?就像listView中设置了CheckBoxes一样
===========================================
第二个问题:
还有,请问怎样才能在DataGrid每行前面加上CheckBoxes?就像listView中设置了CheckBoxes一样用右键点击DataGrid,选择“自动生成属性”,然后增加一个模板列。之后用右键点击DataGrid,选择“编辑模板列”,在模板列中添加一个checkbox控件。
试一下:
DataTable table1 = new DataTable();
this.Datagrid1.DataSource = table1;
this.Datagrid1.DataBinding;
2、这个需要你自己往里加。使用模板。
myTableStyle.MappingName = myds.Tables[0].TableName.ToString();
System.Windows.Forms.DataGridColumnStyle myColStyle = new DataGridTextBoxColumn();
myColStyle.MappingName = "Delegation";
myColStyle.HeaderText = "代表类别";
myTableStyle.GridColumnStyles.Add( myColStyle ); myColStyle = new DataGridTextBoxColumn();
myColStyle.MappingName = "ShallArrive";
myColStyle.HeaderText = "应到";
myTableStyle.GridColumnStyles.Add( myColStyle ); myColStyle = new DataGridTextBoxColumn();
myColStyle.MappingName = "Arrived";
myColStyle.HeaderText = "已到";
myTableStyle.GridColumnStyles.Add( myColStyle ); this.dg_SignInResult.TableStyles.Add( myTableStyle );
用右键点击DataGrid,选择“自动生成属性”,然后增加一个模板列。之后用右键点击DataGrid,选择“编辑模板列”,在模板列中添加一个checkbox控件。
====================================================================
我右击DataGrid既没有看到“自动生成属性”,也没有看到“编辑模板列”啊
// 用一个空表作为各个DataGrid的数据源,使其有列表头和数据显示[1/13/2005]
DataSet set1 = new DataSet();
DataTable table1 = new DataTable("table1");
for(int i=0;i<=20;i++)
table1.Columns.Add(new DataColumn("Column"+i.ToString()));
set1.Tables.Add(table1);
this.dataGridApp.DataSource = set1;
this.dataGridApp.DataMember = table1.TableName;
this.dataGridOne.DataSource = set1;
this.dataGridOne.DataMember = table1.TableName;
===============================
还有,请问怎样才能在DataGrid每行前面加上CheckBoxes?就像listView中设置了CheckBoxes一样
===============================