Ejemplo n.º 1
0
    private void BinddtgData(string TableType)
    {
        DB = CreateDataBase(this.DropDownList1.SelectedValue.Trim());

        if (_PageIndex < 1) _PageIndex = 1;
        _RecordCount = DB.getCount(qrytypelist.SelectedItem.Value, Condition);
        if (_RecordCount > 0)
        {
            _PageCount = _RecordCount / _PageSize;
            if (_RecordCount % _PageSize > 0) _PageCount++;
        }
        DataSet ds = DB.RunProcedure(TableType, _PageSize, _PageIndex, "Asc", Condition);

        dtgData.DataSource = ds.Tables[0].DefaultView;
        dtgData.DataBind();
        ViewState["ds"] = ds;

        lblRecordCount.Text = _RecordCount.ToString();
        lblPageCount.Text = _PageCount.ToString();
        lblPageIndex.Text = _PageIndex.ToString();

        if (_PageIndex > 1)
            lnkPrev.Visible = true;
        else
            lnkPrev.Visible = false;
        if (_PageIndex < _PageCount)
            lnkNext.Visible = true;
        else
            lnkNext.Visible = false;
        BindlsbPage(_PageCount, _PageIndex);
    }