protected void GridView_Documents_Sorting(object sender, GridViewSortEventArgs e)
    {
        string SortExpression = e.SortExpression;
        string SortDirection  = e.SortDirection.ToString() == "Ascending" ? "ASC" : "DESC";

        if (SortExpression != Convert.ToString(Session["Document_SortExpression"]))
        {
            Session["Document_SortExpression"] = SortExpression;
            Session["Document_SortDirection"]  = "DESC";
            SortDirection = "DESC";
        }
        else
        {
            if (Convert.ToString(Session["Document_SortDirection"]) == "ASC")
            {
                SortDirection = "DESC";
            }
            else if (Convert.ToString(Session["Document_SortDirection"]) == "DESC")
            {
                SortDirection = "ASC";
            }

            Session["Document_SortDirection"] = SortDirection;
        }

        SortExpression = SortExpression + " " + SortDirection;

        TreeNode  selectedNode = BrowseTreeView.SelectedNode;
        DataTable dt           = new DataTable();

        if (selectedNode != null)
        {
            int VogId = selectedNode.ImageToolTip == "" ? 0 : Convert.ToInt16(selectedNode.ImageToolTip);
            dt = objBLLCrew.Get_CrewDocumentList(GetCrewID(), txtSearchDoc.Text, selectedNode.Value, VogId, chkArchive.Checked ? 1 : 0);
        }
        else
        {
            dt = objBLLCrew.Get_CrewDocumentList(GetCrewID(), txtSearchDoc.Text, "", 0, chkArchive.Checked ? 1 : 0);
        }

        if (dt.Rows.Count > 0)
        {
            dt.DefaultView.Sort           = SortExpression;
            GridView_Documents.DataSource = dt.DefaultView.ToTable();
            GridView_Documents.DataBind();
        }
        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), ClientID, "FreezeGridView();", true);
    }
    protected void BindGrid()
    {
        TreeNode selectedNode = BrowseTreeView.SelectedNode;

        if (selectedNode != null)
        {
            int       VogId = selectedNode.ImageToolTip == "" ? 0 : Convert.ToInt16(selectedNode.ImageToolTip);
            DataTable dt    = objBLLCrew.Get_CrewDocumentList(GetCrewID(), txtSearchDoc.Text, selectedNode.Value, VogId, chkArchive.Checked ? 1 : 0);
            GridView_Documents.DataSource = dt;
            GridView_Documents.DataBind();
        }
        else
        {
            DataTable dt = objBLLCrew.Get_CrewDocumentList(GetCrewID(), txtSearchDoc.Text, "", 0, chkArchive.Checked ? 1 : 0);
            GridView_Documents.DataSource = dt;
            GridView_Documents.DataBind();
        }
    }
Beispiel #3
0
 private void Load_DocumentList(int CrewID, string FilterString, string DocTypeName)
 {
     GridView_Documents.DataSource = objCrewBLL.Get_CrewDocumentList(CrewID, int.Parse(Session["USERCOMPANYID"].ToString()), FilterString, DocTypeName);
     GridView_Documents.DataBind();
 }