我什至不确定这是否可行,但假设我使用了一个 Datatable 并将其绑定到我的 DataGridView。是否可以将第 3 列设置为下拉列表而不是显示一些文本?编辑:类似的问题,我的代码只是抓住第一个选中的复选框并忽略所有其他的?
//Should iterate over every row
for(int i = 0; i < GridView1.Rows.Count; i++)
{
//Grab the checkbox in the row
CheckBox chkDelete = (CheckBox) GridView1.Rows[i].FindControl("opCheck");
if(chkDelete != null)
{
//If the checkbox exists, see if it is checked
if(chkDelete.Checked)
{
//If it is checked, write out the SQL command and delete it from the database
//Write out the SQL command to delete whatever is checked
command = "SQL_STATEMENT";
cmd = new OleDbCommand(command, con);
//Execute the command and fill the data set
cmd.ExecuteNonQuery();
BindData();
cmd.Dispose();
}
}
}
con.Dispose();
con.Close();