GridView RowDataBound

if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)             //正常查询显示
            {
                Label lblSite = (Label)e.Row.FindControl("lblSite");
                if (!this.ListAuthSite.Contains(lblSite.Text.Trim()))
                {
                    e.Row.Cells[0].Controls[0].Visible = false; //Edit
                }
            }
            if ((e.Row.RowState & DataControlRowState.Edit) != 0)  //RowEditing 绑定
            {
                DropDownList ddl = (DropDownList)e.Row.FindControl("ddlHSCode");
                string site = this.gdvPartNo.DataKeys[e.Row.RowIndex]["site"].ToString();
                PartNoManager ma = apc.GetManager<PartNoManager>();
                DataTable dt = ma.GetHSCode(site);
                ddl.Items.Clear();
                UIUtility.BindDropDownList(ddl, dt, "hs_code", "hs_code", ddl.ToolTip);
            }


        }

posted on 2010-06-03 13:55  AndyCai  阅读(233)  评论(0编辑  收藏  举报

导航