protected void GvQualification_Sorting(object sender, GridViewSortEventArgs e) { DataTable dt = (DataTable)Session["dtFilter"]; string sortdir = "DESC"; if (ViewState["SortDir"] != null) { sortdir = ViewState["SortDir"].ToString(); if (sortdir == "ASC") { e.SortDirection = SortDirection.Descending; ViewState["SortDir"] = "DESC"; } else { e.SortDirection = SortDirection.Ascending; ViewState["SortDir"] = "ASC"; } } else { ViewState["SortDir"] = "DESC"; } dt = (new DataView(dt, "", e.SortExpression + " " + ViewState["SortDir"].ToString(), DataViewRowState.CurrentRows)).ToTable(); Session["dtFilter"] = dt; GvQualification.DataSource = dt; GvQualification.DataBind(); AllPageCode(); }
protected void btnbindrpt_Click(object sender, ImageClickEventArgs e) { if (ddlOption.SelectedIndex != 0) { string condition = string.Empty; if (ddlOption.SelectedIndex == 1) { condition = "convert(" + ddlFieldName.SelectedValue + ",System.String)='" + txtValue.Text + "'"; } else if (ddlOption.SelectedIndex == 2) { condition = "convert(" + ddlFieldName.SelectedValue + ",System.String) like '%" + txtValue.Text + "%'"; } else { condition = "convert(" + ddlFieldName.SelectedValue + ",System.String) Like '" + txtValue.Text + "%'"; } DataTable dtCurrency = (DataTable)Session["dtQualification"]; DataView view = new DataView(dtCurrency, condition, "", DataViewRowState.CurrentRows); GvQualification.DataSource = view.ToTable(); Session["dtFilter"] = view.ToTable(); lblTotalRecords.Text = Resources.Attendance.Total_Records + " : " + view.ToTable().Rows.Count + ""; GvQualification.DataBind(); AllPageCode(); } }
protected void lbtAddQualification_Click(object sender, EventArgs e) { if (ddlQualification.SelectedValue == "") { UCModalError1.ShowMessageError = Resources.errorRegisGeneral_001; UCModalError1.ShowModalError(); return; } DTO.TranSpecial ts = new DTO.TranSpecial(); ts.SPECIAL_TYPE_CODE = ddlQualification.SelectedValue; ts.SPECIAL_TYPE_DESC = ddlQualification.SelectedItem.Text; if (ListTranSpecial.FirstOrDefault(x => x.SPECIAL_TYPE_CODE == ddlQualification.SelectedValue) == null) { ListTranSpecial.Add(ts); GvQualification.DataSource = ListTranSpecial; GvQualification.DataBind(); ddlQualification.SelectedValue = ""; } else { UCModalError1.ShowMessageError = Resources.errorRegisGeneral_002; UCModalError1.ShowModalError(); ddlQualification.SelectedValue = ""; } }
protected void lblDelete_Click(object sender, EventArgs e) { Label lblcode = (Label)((GridViewRow)((LinkButton)sender).Parent.Parent).FindControl("lblCode"); ListTranSpecial.Remove(ListTranSpecial.FirstOrDefault(x => x.SPECIAL_TYPE_CODE == lblcode.Text)); GvQualification.DataSource = ListTranSpecial; GvQualification.DataBind(); }
protected void GvQualification_PageIndexChanging(object sender, GridViewPageEventArgs e) { GvQualification.PageIndex = e.NewPageIndex; DataTable dt = (DataTable)Session["dtFilter"]; GvQualification.DataSource = dt; GvQualification.DataBind(); AllPageCode(); }
private void FillGrid() { DataTable dtBrand = objDesg.GetQualificationMaster(Session["CompId"].ToString().ToString()); lblTotalRecords.Text = Resources.Attendance.Total_Records + ": " + dtBrand.Rows.Count + ""; Session["dtQualification"] = dtBrand; Session["dtFilter"] = dtBrand; if (dtBrand != null && dtBrand.Rows.Count > 0) { GvQualification.DataSource = dtBrand; GvQualification.DataBind(); AllPageCode(); } else { GvQualification.DataSource = null; GvQualification.DataBind(); } }