Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         dvDisobeyRecord.DataSource = DisobeyRecordManager.getAllDisobeyRecord("", "", "全部", "全部");
         dvDisobeyRecord.DataBind();
     }
 }
Esempio n. 2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string statime = txtStatime.Value;
        string endtime = txtEndtime.Value;
        string carType = ddlCharType.SelectedValue;
        string carMark = ddlCarMark.SelectedValue;

        dvDisobeyRecord.DataSource = DisobeyRecordManager.getAllDisobeyRecord(statime, endtime, carType, carMark);
        dvDisobeyRecord.DataBind();
    }
Esempio n. 3
0
    /// <summary>
    /// 利用PagedDataSource做数据源绑定数据分页
    /// </summary>
    /// <param name="pageIndex"></param>
    private void DataBind(int pageIndex)
    {
        string          statime = txtStatime.Value;
        string          endtime = txtEndtime.Value;
        string          carType = ddlCharType.SelectedValue;
        string          carMark = ddlCarMark.SelectedValue;
        PagedDataSource pds     = new PagedDataSource();

        pds.AllowPaging = true;
        pds.PageSize    = CommHelper.GetPageCount;
        IList <DisobeyRecord> list = null;

        if (statime == "" && endtime == "" && carType == "全部" && carMark == "全部")
        {
            list = DisobeyRecordManager.getAllDisobeyRecord("", "", "全部", "全部");
        }
        else
        {
            list = DisobeyRecordManager.getAllDisobeyRecord(statime, endtime, carType, carMark);
        }
        if (list.Count == 0)
        {
            lblMessage.Visible = true;
            lblMessage.Text    = "无相应的记录";
        }
        else
        {
            lblMessage.Visible = false;
        }
        pds.DataSource               = list;
        pds.CurrentPageIndex         = pageIndex;  //取得当前页索引
        Pager1.DataCount             = list.Count; //获取记录数 并赋值
        Pager1.PageCount             = pds.PageCount;
        dvDisobeyRecord.DataSourceID = null;
        dvDisobeyRecord.DataSource   = pds;
        dvDisobeyRecord.DataBind();
    }