就是在Grid列表中的某列绑定Combox.还有个,就是ComBox怎么样能绑定ID和Value?

解决方案 »

  1.   

    是不是自己重写的grid列啊?我只用过自己重写的列,在代码里设置combobox的ValueMember和DisplayMember
      

  2.   

    改变DataGrid的样式
    DataGridTableStyle ts1 = new DataGridTableStyle();
    DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn(new ComboValueChanged(MyComboValueChanged));
    ComboTextCol.MappingName = "custCity";
    ComboTextCol.HeaderText = "Customer Address";
    ComboTextCol.Width = 100;
    ts1.GridColumnStyles.Add(ComboTextCol);
    dataGrid1.TableStyles.Add(ts1);
      

  3.   

    继承DataGridColumnStyle 类,可参考MSDN中关于DataGridColumnStyle 的说明,
    在MSDN中搜索DataGridColumnStyle ,可以看到关于创建一个承载 DateTimePicker 控件的 DataGridColumnStyle实例
      

  4.   

    这个问题好多人早就问过了,请看
    if (this.dataGrid1.CurrentCell.ColumnNumber==1)
    {
    //this.cboPartNumber.Bounds=this.dataGrid1.GetCurrentCellBounds();
    this.cboPartNumber.Left=this.dataGrid1.GetCurrentCellBounds().Left + this.dataGrid1.Left;
    this.cboPartNumber.Top=this.dataGrid1.GetCurrentCellBounds().Top + this.dataGrid1.Top;
    this.cboPartNumber.Width=this.dataGrid1.GetCurrentCellBounds().Width;
    this.cboPartNumber.Height=this.dataGrid1.GetCurrentCellBounds().Height;
    this.cboPartNumber.Visible=true;
    this.cboPartNumber.BringToFront();
    this.cboPartNumber.Text=this.dataGrid1[this.dataGrid1.CurrentCell].ToString();
    }
    else
    {
    this.cboPartNumber.Visible=false;
    }
      

  5.   

    告诉你一个苯办法,你可以在.net的搜索中输入DataGrid,你应该能看到你想找的主题。我的好多问题就是这样解决的。
    你可以试一下.