public ConfigGridView ConCreateGridView(BLL.DataCenterBiz biz, DTO.DataItem licenseType) { ConfigGridView configGridView = new ConfigGridView(String.Format("gvConfig_{0}", licenseType.Id)); IEnumerable <DTO.ConfigDocument> configs = ConfigDataSource.Where(c => c.LICENSE_TYPE_CODE == licenseType.Id); if (configs != null && configs.Count() > 0) { configGridView = new ConfigGridView(String.Format("gvConfig_{0}", licenseType.Id)); /********** Config GridView **************/ configGridView.AutoGenerateColumns = false; configGridView.HorizontalAlign = HorizontalAlign.Center; configGridView.Caption = licenseType.Name; //configGridView.SelectedDataKey["ID"].ToString(); configGridView.CaptionAlign = TableCaptionAlign.Left; /************ Add Columns ****************/ configGridView.AddLabelTemplateField("ID", "ID", 5, true); configGridView.AddLabelRowNumberField("ลำดับ", "ID", 5, true); configGridView.AddBoundField("LICENSE_TYPE_CODE", "LICENSE_TYPE_CODE", "", 0, false); configGridView.AddBoundField("เอกสาร", "DOCUMENT_NAME", "", 73, true); configGridView.AddTemplateField("ต้องทำการแนบเอกสาร", "IS_REQUIRE", 12); configGridView.AddLinkButtonTemplateField("ดำเนินการ", "ID", 6); configGridView.DataSource = configs; } return(configGridView); }
protected void InitGridView(BLL.DataCenterBiz biz) { IEnumerable <DTO.DataItem> licenseTypes = biz.GetLicenseType("").DataResponse; licenseTypes.ToList().RemoveAt(0); foreach (DTO.DataItem licenseType in licenseTypes) { ConfigGridView gvDataView = ConCreateGridView(biz, licenseType); gvDataView.LinkButtonDelete_Success += new EventHandler(LinkButtonDelete_Success); this.Controls.Add(gvDataView); gvDataView.DataBind(); } }