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.Trim() + "'";
         }
         else if (ddlOption.SelectedIndex == 2)
         {
             condition = "convert(" + ddlFieldName.SelectedValue + ",System.String) like '%" + txtValue.Text.Trim() + "%'";
         }
         else
         {
             condition = "convert(" + ddlFieldName.SelectedValue + ",System.String) Like '" + txtValue.Text.Trim() + "%'";
         }
         DataTable dtCurrency = (DataTable)Session["dtCurrency"];
         DataView  view       = new DataView(dtCurrency, condition, "", DataViewRowState.CurrentRows);
         GvCurrency.DataSource = view.ToTable();
         Session["dtFilter"]   = view.ToTable();
         lblTotalRecords.Text  = Resources.Attendance.Total_Records + " : " + view.ToTable().Rows.Count + "";
         GvCurrency.DataBind();
     }
 }
    protected void GvCurrency_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;
        GvCurrency.DataSource = dt;
        GvCurrency.DataBind();
    }
    protected void GvCurrency_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GvCurrency.PageIndex = e.NewPageIndex;
        DataTable dt = (DataTable)Session["dtFilter"];

        GvCurrency.DataSource = dt;
        GvCurrency.DataBind();
    }
    private void FillGrid()
    {
        DataTable dtBrand = objCurr.GetCurrencyMaster();

        lblTotalRecords.Text  = Resources.Attendance.Total_Records + " : " + dtBrand.Rows.Count + "";
        Session["dtCurrency"] = dtBrand;
        Session["dtFilter"]   = dtBrand;
        if (dtBrand != null && dtBrand.Rows.Count > 0)
        {
            GvCurrency.DataSource = dtBrand;
            GvCurrency.DataBind();
        }
        else
        {
            GvCurrency.DataSource = null;
            GvCurrency.DataBind();
        }
    }
    protected void bindGridData()
    {
        List <ParaList> para = new List <ParaList>()
        {
            new ParaList {
                Key = "@i_CompId", Value = CurrentUser.CompId
            },
        };



        dtCurrency = crmclient.list(para, "Currency");
        if (dtCurrency.Tables[0].Rows.Count > 0)
        {
            GvCurrency.DataSource = dtCurrency.Tables[0];
            GvCurrency.DataBind();
        }
        else
        {
            GvCurrency.DataSource = ReturnEmptyRow();
            GvCurrency.DataBind();
        }
    }