Ejemplo n.º 1
0
    private void BindGv()
    {
        this.ViewState["Task"] = EReport.GetTaskReport(this.tvBudget.SelectedValue, this.txtCode.Text.Trim(), this.txtName.Text.Trim());
        DataTable dataTable = this.ViewState["Task"] as DataTable;

        if (dataTable != null)
        {
            this.AspNetPager1.RecordCount = dataTable.Rows.Count;
            this.AspNetPager1.PageSize    = NBasePage.pagesize;
            this.gvBudget.DataSource      = EReport.GetPageDataTable(dataTable, this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize);
            this.gvBudget.DataKeyNames    = new string[]
            {
                "TaskId"
            };
            this.gvBudget.DataBind();
            if (dataTable.Rows.Count != 0)
            {
                string[] value = new string[]
                {
                    dataTable.Compute("SUM(TotalBudget)", string.Empty).ToString(),
                    dataTable.Compute("SUM(TotalAcc)", string.Empty).ToString(),
                    dataTable.Compute("SUM(JieChao)", string.Empty).ToString()
                };
                int[] index = new int[]
                {
                    6,
                    7,
                    8
                };
                GridViewUtility.AddTotalRow(this.gvBudget, value, index);
                this.ViewState["Total"] = value;
                return;
            }
        }
        else
        {
            this.gvBudget.DataSource = dataTable;
            this.gvBudget.DataBind();
        }
    }