更新时间:2023-10-19 16:54:40
如果你想在DropDownList中添加
,然后您必须以其他方式执行此操作,因为CheckBox
DropDownList
不支持此类默认行为。
所以,你应该去 DropDownCheckList ASP.NET服务器控件 [ ^ ] 。
您可以将其添加到GridView
并尝试。
一切顺利。 :)
If you want to addCheckBox
insideDropDownList
, then you have to do it in some other way because there is no such default behaviour supported byDropDownList
.
So, you should go for DropDownCheckList ASP.NET Server Control[^].
You can add this to yourGridView
and try.
All the best. :)
尝试这样的事情..
Try something like this..
protected void btnGrid2Insert_Click(object sender, EventArgs e)
{
foreach (GridViewRow gvRow in gvGrid1.Rows)
{
DropDownList ddl = (gvRow.Cells[5].FindControl("ddlName") as DropDownList);
DataTable dt = getYourSource();
ddl.DataSource = dt;
ddl.DataTextField = "";
ddl.DataValueField = "";
ddl.DataBind();
}
}