Rowdatabound上有多个Gridview?

时间:2014-02-19 05:54:34

标签: c# asp.net gridview

   protected void gvMeatDispatch_RowDataBound(object sender, GridViewRowEventArgs e)
    {        
        if (e.Row.Parent.Parent.ID == "gvMeatDispatch")
        {
            DataTable dtpartyname = new DataTable();
            objRetailPL.status = 4;
            dtpartyname = objRetailBAL.GetType(objRetailPL);

            DropDownList ddlpn = (DropDownList)e.Row.FindControl("ddlpartyname");
            if (ddlpn != null)
            {
                ddlpn.DataSource = dtpartyname;
                ddlpn.DataTextField = "partyname";
                ddlpn.DataValueField = "sno";
                ddlpn.DataBind();
                ddlpn.Items.Add(new ListItem("--Select--", "0"));
                ddlpn.SelectedIndex = ddlpn.Items.Count - 1;
            }
        }
       if (e.Row.Parent.Parent.ID== "gvRetail")
         {
            DataTable dttypeRT = new DataTable();
            dttypeRT = objRetailBAL.getretailtype();

            DropDownList ddl = (DropDownList)e.Row.FindControl("ddltype");
            if (ddl != null)
            {
                ddl.DataSource = dttypeRT;
                ddl.DataTextField = "type";
                ddl.DataValueField = "sno";
                ddl.DataBind();
                ddl.Items.Add(new ListItem("--Select--", "0"));
                ddl.SelectedIndex = ddl.Items.Count - 1;
            }
        }
    }

这里“gvMeatDispatch”和“gvRetail”是行数据绑定的两个网格视图...如果条件满足但第二个“gvRetail”没有执行..请帮助我

0 个答案:

没有答案