dataGridview里加入下拉框的方法
datagridview外加下拉框
public WentiFankui()//文件名方法
{
InitComboBoxValues();
this.dataGridView1.Controls.Add(this.comboBox1);
this.dataGridView1.Controls.Add(this.comboBox2);
this.dataGridView1.Controls.Add(this.comboBox3);
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
comboBox2.DropDownStyle = ComboBoxStyle.DropDownList;
}
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
{
comboBox3.DropDownStyle = ComboBoxStyle.DropDownList;
}
private void GetTypeColumn()//获取问题类型
{
StringBuilder sql1 = new StringBuilder();
sql1.Append(" SELECT BT.ID ");
sql1.Append(" ,BT.TypeName ");
sql1.Append(" FROM BugType BT with (nolock) ");
sql1.Append(" WHERE 1=1 ");
sql1.Append(" AND IsEnable=1 ");
DataTable tab = lj.dataset(sql1.ToString()).Tables[0];
DataRow row = tab.NewRow();
//row["ID"] = 0;
//row["TypeName"] = "";
tab.Rows.InsertAt(row, 0);
comboBox2.DataSource = tab;
comboBox2.DisplayMember = "TypeName";
comboBox2.ValueMember = "ID";
comboBox2.SelectedIndex = -1;
}
private void GetCancelColumn()//获取撤销原因
{