示例#1
0
    protected void GvOptionCategory_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;
        GvOptionCategory.DataSource = dt;
        GvOptionCategory.DataBind();

        AllPageCode();
        GvOptionCategory.HeaderRow.Focus();
    }
示例#2
0
 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["dtoptionCate"];
         DataView  view       = new DataView(dtCurrency, condition, "", DataViewRowState.CurrentRows);
         GvOptionCategory.DataSource = view.ToTable();
         Session["dtFilter"]         = view.ToTable();
         lblTotalRecords.Text        = Resources.Attendance.Total_Records + " : " + view.ToTable().Rows.Count + "";
         GvOptionCategory.DataBind();
         AllPageCode();
         btnbind.Focus();
     }
 }
示例#3
0
    protected void GvOptionCategory_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GvOptionCategory.PageIndex = e.NewPageIndex;
        DataTable dt = (DataTable)Session["dtFilter"];

        GvOptionCategory.DataSource = dt;
        GvOptionCategory.DataBind();
        AllPageCode();
        GvOptionCategory.BottomPagerRow.Focus();
    }
示例#4
0
    public void FillGrid()
    {
        DataTable dt = objOptionCategory.GetOptionCategoryTrueAll(StrCompId.ToString());

        Session["dtoptionCate"]     = dt;
        Session["dtFilter"]         = dt;
        GvOptionCategory.DataSource = dt;
        GvOptionCategory.DataBind();
        lblTotalRecords.Text = Resources.Attendance.Total_Records + " : " + dt.Rows.Count.ToString();
        AllPageCode();
    }