本文介绍了如何根据其他网格获取网格控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







i有两个网格grid1和grid2。



grid1的最后一列有下拉列表。




$ 2 $ b在grid2中我们点击添加按钮,我们获得新行。按钮点击新行将添加到grid2。





现在我的要求是每当我在grid2中有新行时,应自动添加一个复选框to griddown




i have two grid grid1 and grid2.

grid1 has last column has dropdown.


in grid2 we have add button on clicking which we get new rows.on button click new row will be added to grid2.


now my requirement is whenever i had new row in grid2 automatically a check box should be added to dropdown in grid1

推荐答案


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();
        }
    }


这篇关于如何根据其他网格获取网格控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 17:05