private void BindAnnexure(Int64 billno) { AnnexureReportDAL obj = new AnnexureReportDAL(); var lst = obj.selectannexureno(billno); obj = null; if (lst != null && lst.Count > 0) { ddlAnnexure.Enabled = true; ddlAnnexure.DataSource = lst; ddlAnnexure.DataTextField = "Name"; ddlAnnexure.DataValueField = "Value"; ddlAnnexure.DataBind(); ddlAnnexure.Items.Insert(0, new ListItem("--Select--", "0")); } if (lst == null && lst.Count == 0) { ddlAnnexure.DataSource = null; ddlAnnexure.DataBind(); ddlAnnexure.Enabled = false; } }
private void BindGrid() { AnnexureReportDAL obj = new AnnexureReportDAL(); Int32 intyearid = Convert.ToInt32(ddlDateRange.SelectedValue); if (string.IsNullOrEmpty(txtBillNo.Text.Trim())) { ShowMessageErr("Invoice No cannot be blank."); } else { DataTable list = obj.SelectRep("Annexure", txtBillNo.Text.Trim(), ddlAnnexure.SelectedValue, intyearid, conString); if ((list != null) && (list.Rows.Count > 0)) { if (PrintRpt() == true) { ViewState["CSVdt"] = list; fillAnnexureRpt(); lnkbtnPrint.Visible = true; imgBtnExcel.Visible = true; } ViewState["CSVdt"] = list; grdMain.DataSource = list; grdMain.DataBind(); lblTotalRecord.Text = "T. Record (s): " + list.Rows.Count; lnkbtnPrint.Visible = true; imgBtnExcel.Visible = true; } else { grdMain.DataSource = null; grdMain.DataBind(); ViewState["CSVdt"] = null; lblTotalRecord.Text = "Total Record (s): 0 "; lnkbtnPrint.Visible = false; imgBtnExcel.Visible = false; } } }