void BindDeposits() { if (Session["UserID"] != null) { objBal = new ClsBAL(); DataSet ds = objBal.GetAgentDepositsByUserId(Convert.ToInt32(Session["UserID"].ToString())); gvDeposits.DataSource = ds; gvDeposits.DataBind(); } else { Response.Redirect("~/Default.aspx", false); } }
protected void gvDeposits_Sorting(object sender, GridViewSortEventArgs e) { try { string strExpression = e.SortExpression; string strDirection = ViewState["SortDirection"].ToString(); objBal = new ClsBAL(); DataSet ds = objBal.GetAgentDepositsByUserId(Convert.ToInt32(Session["UserID"].ToString())); DataTable dt = ds.Tables[0]; DataView dv = new DataView(dt); dv.Sort = strExpression + strDirection; gvDeposits.DataSource = dv; gvDeposits.DataBind(); if (strDirection == " ASC") { ViewState["SortDirection"] = " DESC"; } else { ViewState["SortDirection"] = " ASC"; } } catch (Exception ex) { lblMsg.InnerHtml = ex.Message; throw; } }