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 dtProjectteam = (DataTable)Session["dtProjectmaster"];

            DataView view = new DataView(dtProjectteam, condition, "", DataViewRowState.CurrentRows);
            GvrProjectteam.DataSource = view.ToTable();
            Session["dtFilter"] = view.ToTable();
            lblTotalRecords.Text = Resources.Attendance.Total_Records + " : " + view.ToTable().Rows.Count + "";
            GvrProjectteam.DataBind();
             AllPageCode();
        }
    }
    protected void GvrProjectteam_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;
        GvrProjectteam.DataSource = dt;
        GvrProjectteam.DataBind();

        AllPageCode();
    }
 protected void GvrProjectteam_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GvrProjectteam.PageIndex = e.NewPageIndex;
     DataTable dt = (DataTable)Session["dtFilter"];
     GvrProjectteam.DataSource = dt;
     GvrProjectteam.DataBind();
     AllPageCode();
 }
    public void BindGrid()
    {
        DataTable dtProjectMAster = objProjctMaster.GetAllRecordProjectMasteer();
       
        if (dtProjectMAster.Rows.Count > 0)
        {

            GvrProjectteam.DataSource = dtProjectMAster;
            GvrProjectteam.DataBind();
            Session["dtFilter"] = dtProjectMAster;
            Session["dtProjectmaster"] = dtProjectMAster;
        }
        else
        {
            DataTable Dtclear = new DataTable();
            GvrProjectteam.DataSource = Dtclear;
            GvrProjectteam.DataBind();
        }
        lblTotalRecords.Text = Resources.Attendance.Total_Records + ": " + dtProjectMAster.Rows.Count + "";
        AllPageCode();
    
    
    
    }
Esempio n. 5
0
    public void getprojectteam()
    {
        DataTable dtRecord = new DataTable();

        dtRecord.Columns.Add("Project_Id");
        dtRecord.Columns.Add("Project_Name");
        dtRecord.Columns.Add("counters");

        int counters = 0;


        DataTable dtProjectrecord = new DataTable();

        dtProjectrecord.Columns.Add("counters");



        dtProjectrecord = objProjectteam.GetAllProjectTeam();

        if (dtProjectrecord.Rows.Count > 0)
        {
            DataTable dt = new DataTable();
            dtProjectrecord = new DataView(dtProjectrecord, "", "", DataViewRowState.CurrentRows).ToTable(true, "Project_Id");
            for (int i = 0; i < dtProjectrecord.Rows.Count; i++)
            {
                DataRow dr = dtRecord.NewRow();
                dt       = objProjectteam.GetAllProjectTeam();
                counters = 0;
                dt       = new DataView(dt, "Project_Id=" + dtProjectrecord.Rows[i]["Project_Id"].ToString() + "", "", DataViewRowState.CurrentRows).ToTable();
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    counters += 1;
                }

                dr[0] = dt.Rows[0]["Project_Id"].ToString();
                dr[1] = dt.Rows[0]["Project_Name"].ToString();
                dr[2] = counters.ToString();


                dtRecord.Rows.Add(dr);
            }
        }
        else
        {
        }



        if (dtRecord.Rows.Count > 0)
        {
            GvrProjectteam.DataSource = dtRecord;
            GvrProjectteam.DataBind();
            Session["dtprojectteamrecord"] = dtRecord;
            Session["dtFilter"]            = dtRecord;
        }
        else
        {
            DataTable Dtclear = new DataTable();
            GvrProjectteam.DataSource = Dtclear;
            GvrProjectteam.DataBind();
        }
        lblTotalRecords.Text = Resources.Attendance.Total_Records + ": " + dtRecord.Rows.Count + "";
        AllPageCode();
    }