예제 #1
0
    //绑定提交实验列表
    public void DataBindExperments(int experimentResourceId)
    {
        DalOperationAboutExperiment dalOperationAboutExperiment = new DalOperationAboutExperiment();

        string studentName = txtNameSearch.Text;
        DataView dv = null;
        if ((txtlow.Text != null && txtlow.Text.Length > 0) || (txthigh.Text != null && txthigh.Text.Length > 0))
        {
            float low = (txtlow.Text == null || txtlow.Text.Equals("")) ? float.MinValue : float.Parse(txtlow.Text.Trim());
            float high = (txthigh.Text == null || txtlow.Text.Equals("")) ? float.MaxValue : float.Parse(txthigh.Text.Trim());
            dv = dalOperationAboutExperiment.GetExperimentsByResourcesId(experimentResourceId,studentName,low,high).Tables[0].DefaultView;
        }
        else
        {
            dv = dalOperationAboutExperiment.GetExperimentsByResourcesId(experimentResourceId,studentName).Tables[0].DefaultView;
        }
        this.AspNetPager2.RecordCount = dv.Count;

        PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
        pds.DataSource = dv;
        pds.AllowPaging = true;

        pds.CurrentPageIndex = pageIndex - 1;
        pds.PageSize = CommonUtility.pageSize; ;

        this.ddlstExp.DataSource = pds;
        this.ddlstExp.DataBind();

        if (pds.Count > 0) {
            this.ddlstExp.ShowFooter = false;
        }
    }