/* Change: Added BindGrid(string stateOfRadioButton) */ private void BindGrid(string stateOfRadioButton) { if (stateOfRadioButton == "latest") { int EmpID = (int)HttpContext.Current.Session["EmpID"]; if (VoucherBizLogic.ListPendingVoucherRequests(EmpID).Any()) { List <PendingVoucherRequest> latestVoucherRequest = new List <PendingVoucherRequest>(); latestVoucherRequest.Add(VoucherBizLogic.ListPendingVoucherRequests(EmpID).Last()); PendingVouchersGridView.DataSource = latestVoucherRequest; // hardcoded employeeid for now, need to retrieve later PendingVouchersGridView.DataBind(); } else { Response.Write("<script>alert('No pending voucher !');</script>"); /* Changed 7-2-19 */ List <PendingVoucherRequest> emptyList = new List <PendingVoucherRequest>(); PendingVouchersGridView.DataSource = emptyList; PendingVouchersGridView.DataBind(); } } else if (stateOfRadioButton == "all") { int EmpID = (int)HttpContext.Current.Session["EmpID"]; PendingVouchersGridView.DataSource = VoucherBizLogic.ListPendingVoucherRequests(EmpID); // hardcoded employeeid for now, need to retrieve later PendingVouchersGridView.DataBind(); } }
protected void PendingVouchersGridView_PageIndexChanging(object sender, GridViewPageEventArgs e) { PendingVouchersGridView.PageIndex = e.NewPageIndex; PendingVouchersGridView.DataBind(); BindGridAuto(); }