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