protected void BindPage() { PAGE_SIZE = Convert.ToInt32(txtInputMaxrow.Text); var biz = new BLL.PaymentBiz(); var resultPage = txtNumberGvSearch.Text.ToInt(); var res = biz.GetPaymentLicenseAppove(ddlTypePay.SelectedValue.ToString(), txtIdCard.Text, txtOrder.Text, Convert.ToDateTime(txtStartDate.Text) , Convert.ToDateTime(txtEndDate.Text), txtFirstName.Text, txtLastName.Text, "N", resultPage, PAGE_SIZE); gvSearch.Visible = true; gvSearch.DataSource = res.DataResponse; gvSearch.DataBind(); }
private void BindDataInGridView() { //PAGE_SIZE = PAGE_SIZE_Key; PAGE_SIZE = Convert.ToInt16(txtInputMaxrow.Text); gvSearch.Visible = true; var resultPage = txtNumberGvSearch.Text.ToInt(); var biz = new BLL.PaymentBiz(); var resCount = biz.GetPaymentLicenseAppove(ddlTypePay.SelectedValue.ToString(), txtIdCard.Text, txtOrder.Text, Convert.ToDateTime(txtStartDate.Text) , Convert.ToDateTime(txtEndDate.Text), txtFirstName.Text, txtLastName.Text, "Y", resultPage, PAGE_SIZE); DataSet ds = resCount.DataResponse; DataTable dt = ds.Tables[0]; DataRow drLicense = ds.Tables[0].Rows[0]; int rowCount = Convert.ToInt32(drLicense["rowcount"].ToString()); double dblPageCount = (double)((decimal)rowCount / PAGE_SIZE); TotalPages = (int)Math.Ceiling(dblPageCount); txtTotalPage.Text = Convert.ToString(TotalPages); var res = biz.GetPaymentLicenseAppove(ddlTypePay.SelectedValue.ToString(), txtIdCard.Text, txtOrder.Text, Convert.ToDateTime(txtStartDate.Text) , Convert.ToDateTime(txtEndDate.Text), txtFirstName.Text, txtLastName.Text, "N", resultPage, PAGE_SIZE); if (res.IsError) { UCModalError.ShowMessageError = res.ErrorMsg; UCModalError.ShowModalError(); } else { gvSearch.DataSource = res.DataResponse; gvSearch.DataBind(); gvSearch.Visible = true; if (TotalPages == 0) { divGv1.Visible = true; txtNumberGvSearch.Visible = true; lblParaPage.Visible = true; txtTotalPage.Visible = true; btngo.Visible = true; lblTotalrecord.Text = "0"; txtTotalPage.Text = "1"; txtInputMaxrow.Visible = true; lblHeadInputMaxrow.Visible = true; lblHeadTotal.Visible = true; lblTotalrecord.Visible = true; lblEndTotal.Visible = true; CheckBox ckall = (CheckBox)gvSearch.HeaderRow.FindControl("Checkall"); ckall.Visible = false; } else if (TotalPages > 1) { txtNumberGvSearch.Visible = true; lblParaPage.Visible = true; txtTotalPage.Visible = true; btnNextGvSearch.Visible = true; btnPreviousGvSearch.Visible = false; btngo.Visible = true; lblTotalrecord.Text = drLicense["rowcount"].ToString(); txtInputMaxrow.Visible = true; lblHeadInputMaxrow.Visible = true; lblHeadTotal.Visible = true; lblTotalrecord.Visible = true; lblEndTotal.Visible = true; btnGenLicense.Visible = true; divGv1.Visible = true; } else if (TotalPages == 1) { txtNumberGvSearch.Visible = true; lblParaPage.Visible = true; txtTotalPage.Visible = true; btnGenLicense.Visible = true; btngo.Visible = true; btnPreviousGvSearch.Visible = false; lblTotalrecord.Text = drLicense["rowcount"].ToString(); txtInputMaxrow.Visible = true; lblHeadInputMaxrow.Visible = true; lblHeadTotal.Visible = true; lblTotalrecord.Visible = true; lblEndTotal.Visible = true; divGv1.Visible = true; } if (gvSearch.Rows.Count == 0) { btnGenLicense.Visible = false; } else { btnGenLicense.Visible = true; } //UpdatePanelSearch.Update(); } }