protected void GridViewLoan_Sorting(object sender, GridViewSortEventArgs e) { HDFSort.Value = HDFSort.Value == "ASC" ? "DESC" : "ASC"; DataTable dt = new DataTable(); dt = (DataTable)Session["dtFilter"]; DataView dv = new DataView(dt); string Query = "" + e.SortExpression + " " + HDFSort.Value + ""; dv.Sort = Query; dt = dv.ToTable(); Session["dtFilter"] = dt; GridViewLoan.DataSource = dt; GridViewLoan.DataBind(); }
void GridBind() { DataTable Dt = new DataTable(); Dt = ObjLoan.GetRecord_From_PayEmployeeLoan(strCompId, "0", "Pending"); if (Dt.Rows.Count > 0) { GridViewLoan.DataSource = Dt; GridViewLoan.DataBind(); Session["dtFilter"] = Dt; } else { DataTable Dtclear = new DataTable(); GridViewLoan.DataSource = Dtclear; GridViewLoan.DataBind(); } }
// Code for Liability view void FillGridLoan() { if ((string)Session["AdminSessionID"] != null) { SqlDataAdapter GDA = new SqlDataAdapter(" " + " select Code, LoanTakenFor=(Select [Name] from fp_ComboDetail where Code=r.LoanTaken ), " + " OriginalAmount,RateofInterest,LoanType,EMI,LoanTenure,OutStandingBalance,StartDate=convert(varchar(11),StartDate,113) " + " from fp_Loan r where ClientCode=" + ViewState["xClientCode"] + " " + " ", Con); DataSet GDS = new DataSet(); Con.Open(); GDA.Fill(GDS); Con.Close(); GridViewLoan.DataSource = GDS; GridViewLoan.DataBind(); } else { Response.Redirect("SessionExpired.aspx"); } }