protected void GvDeductionBin_PageIndexChanging(object sender, GridViewPageEventArgs e) { GvDeductionBin.PageIndex = e.NewPageIndex; DataTable dt = (DataTable)Session["dtBinFilter"]; GvDeductionBin.DataSource = dt; GvDeductionBin.DataBind(); AllPageCode(); string temp = string.Empty; for (int i = 0; i < GvDeductionBin.Rows.Count; i++) { Label lblconid = (Label)GvDeductionBin.Rows[i].FindControl("lblgvDeductionId"); string[] split = lblSelectedRecord.Text.Split(','); for (int j = 0; j < lblSelectedRecord.Text.Split(',').Length; j++) { if (lblSelectedRecord.Text.Split(',')[j] != "") { if (lblconid.Text.Trim().ToString() == lblSelectedRecord.Text.Split(',')[j].Trim().ToString()) { ((CheckBox)GvDeductionBin.Rows[i].FindControl("chkgvSelect")).Checked = true; } } } } }
protected void GvDeductionBin_Sorting(object sender, GridViewSortEventArgs e) { HDFSortbin.Value = HDFSortbin.Value == "ASC" ? "DESC" : "ASC"; DataTable dt = new DataTable(); dt = ObjAddDed.GetDeductionFalseAll(StrCompId.ToString()); DataView dv = new DataView(dt); string Query = "" + e.SortExpression + " " + HDFSortbin.Value + ""; dv.Sort = Query; dt = dv.ToTable(); Session["dtInactive"] = dt; GvDeductionBin.DataSource = dt; GvDeductionBin.DataBind(); lblSelectedRecord.Text = ""; AllPageCode(); }
protected void btnbindBin_Click(object sender, ImageClickEventArgs e) { string condition = string.Empty; if (ddlOptionBin.SelectedIndex != 0) { if (ddlOptionBin.SelectedIndex == 1) { condition = "convert(" + ddlFieldNameBin.SelectedValue + ",System.String)='" + txtValueBin.Text + "'"; } else if (ddlOptionBin.SelectedIndex == 2) { condition = "convert(" + ddlFieldNameBin.SelectedValue + ",System.String) like '%" + txtValueBin.Text + "%'"; } else { condition = "convert(" + ddlFieldNameBin.SelectedValue + ",System.String) Like '" + txtValueBin.Text + "%'"; } DataTable dtCust = (DataTable)Session["dtBinDeduction"]; DataView view = new DataView(dtCust, condition, "", DataViewRowState.CurrentRows); Session["dtBinFilter"] = view.ToTable(); lblTotalRecordsBin.Text = Resources.Attendance.Total_Records + " : " + view.ToTable().Rows.Count.ToString() + ""; GvDeductionBin.DataSource = view.ToTable(); GvDeductionBin.DataBind(); lblSelectedRecord.Text = ""; if (view.ToTable().Rows.Count == 0) { imgBtnRestore.Visible = false; ImgbtnSelectAll.Visible = false; } else { AllPageCode(); } System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtValueBin); } }
protected void ImgbtnSelectAll_Click(object sender, ImageClickEventArgs e) { DataTable dtDeduction = (DataTable)Session["dtbinFilter"]; if (ViewState["Select"] == null) { ViewState["Select"] = 1; foreach (DataRow dr in dtDeduction.Rows) { if (!lblSelectedRecord.Text.Split(',').Contains(dr["Deduction_Id"])) { lblSelectedRecord.Text += dr["Deduction_Id"] + ","; } } for (int i = 0; i < GvDeductionBin.Rows.Count; i++) { string[] split = lblSelectedRecord.Text.Split(','); Label lblconid = (Label)GvDeductionBin.Rows[i].FindControl("lblgvDeductionId"); for (int j = 0; j < lblSelectedRecord.Text.Split(',').Length; j++) { if (lblSelectedRecord.Text.Split(',')[j] != "") { if (lblconid.Text.Trim().ToString() == lblSelectedRecord.Text.Split(',')[j].Trim().ToString()) { ((CheckBox)GvDeductionBin.Rows[i].FindControl("chkgvSelect")).Checked = true; } } } } } else { lblSelectedRecord.Text = ""; DataTable dtAddressCategory1 = (DataTable)Session["dtBinFilter"]; GvDeductionBin.DataSource = dtAddressCategory1; GvDeductionBin.DataBind(); ViewState["Select"] = null; } }
public void FillGridBin() { DataTable dt = new DataTable(); dt = ObjAddDed.GetDeductionFalseAll(StrCompId.ToString()); GvDeductionBin.DataSource = dt; GvDeductionBin.DataBind(); Session["dtBinDeduction"] = dt; Session["dtBinFilter"] = dt; lblTotalRecordsBin.Text = Resources.Attendance.Total_Records + ": " + dt.Rows.Count.ToString() + ""; lblSelectedRecord.Text = ""; if (dt.Rows.Count == 0) { imgBtnRestore.Visible = false; ImgbtnSelectAll.Visible = false; } else { AllPageCode(); } }