且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何根据其他网格获取网格控件

更新时间:2023-10-19 16:54:40

如果你想在 DropDownList中添加 CheckBox ,然后您必须以其他方式执行此操作,因为 DropDownList 不支持此类默认行为。



所以,你应该去 DropDownCheckList ASP.NET服务器控件 [ ^ ] 。



您可以将其添加到 GridView 并尝试。



一切顺利。 :)
If you want to add CheckBox inside DropDownList, then you have to do it in some other way because there is no such default behaviour supported by DropDownList.

So, you should go for DropDownCheckList ASP.NET Server Control[^].

You can add this to your GridView 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();
        }
    }