private void BindGrid() { // 到数据库捞取 PmsMinconclutionBiz pmsMinconclutionBiz = new PmsMinconclutionBiz(); IList <PmsMinconclution> pmsMinconclutionList = pmsMinconclutionBiz.SelectPmsMinconclutionByMinId(MinID); if (pmsMinconclutionList != null) { GridViewConclusion.DataSource = pmsMinconclutionList; GridViewConclusion.DataBind(); } }
/// <summary> /// For Page_Load /// </summary> private void BindGrid() { // 到数据库捞取 PmsMinconclutionBiz pmsMinconclutionBiz = new PmsMinconclutionBiz(); IList <PmsMinconclution> pmsMinconclutionList = pmsMinconclutionBiz.SelectPmsMinconclutionByMinId(MinID); InitPmsMinconclutionList = pmsMinconclutionList; //编辑前的数据保存到InitPmsMinconclutionList if (pmsMinconclutionList != null && pmsMinconclutionList.Count > 0) { GridViewConclusion.DataSource = pmsMinconclutionList; GridViewConclusion.DataBind(); } else { pmsMinconclutionList = new List <PmsMinconclution>() { new PmsMinconclution() }; GridViewConclusion.DataSource = pmsMinconclutionList; GridViewConclusion.DataBind(); GridViewConclusion.Rows[0].Visible = false; //隐藏了一行需要特别注意,保存的时候排除掉 } }