public partial class BusiView_Busi_Query : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Init_Page();
BindData();
}
}
private void Init_Page()
{
txt_BeginDate.Value = DateTime.Now.ToShortDateString();
txt_EndDate.Value = DateTime.Now.ToShortDateString();
}
private void BindData()
{
string sdate = (txt_BeginDate.Value == "" ? DateTime.Now.ToShortDateString() : txt_BeginDate.Value);
string edate = (txt_EndDate.Value == "" ? DateTime.Now.ToShortDateString() : txt_EndDate.Value);
Acction_BusiBaseInfo_list abbl = new Acction_BusiBaseInfo_list();
DataTable dt = new DataTable ();
dt = abbl.Busi_Query(sdate, edate, txt_QueryCode.Value.ToString());
ViewState["DataSource"] = dt;
if (dt != null)
{
if (dt.Rows.Count == 0)
{
this.rp_list.DataSource = dt;
this.rp_list.DataBind();
this.PageBar1.Visible = false;
this.nodata.Visible = true;
}
else
{
this.PageBar1.Visible = true;
this.nodata.Visible = false;
PagedDataSource pd = new PagedDataSource();
this.PageBar1.RecordCount = dt.Rows.Count;
pd.PageSize = PageBar1.PageSize;
pd.CurrentPageIndex = this.PageBar1.PageIndex - 1;
pd.AllowPaging = true;
pd.DataSource = dt.DefaultView;
this.rp_list.DataSource = pd;
this.rp_list.DataBind();
}
this.rp_export.DataSource = dt;
this.rp_export.DataBind();
}
}
protected void btn_Refresh_Click(object sender, EventArgs e)
{
BindData();
}
protected void PageBar1_PageIndexChange(object sender, EventArgs e)
{
BindData();
}