//导出 protected void btn_Get_Click(object sender, EventArgs e) { try { if (page == 0) { List <Common.Entities.AchieveAward> list = award.FindPaged(Convert.ToInt32(Session["secrecyLevel"])); if (list != null) { Grid_AchieveAward.DataSource = list; Grid_AchieveAward.DataBind(); } } else if (page == 1) { List <Common.Entities.AchieveAward> list = award.FindByNameAndGrade(tAchieveName.Text.Trim(), Convert.ToInt32(Session["secrecyLevel"])); if (list != null) { Grid_AchieveAward.DataSource = list; Grid_AchieveAward.DataBind(); } } else if (page == 2) { List <Common.Entities.AchieveAward> list = award.FindByAwardUnit(tAchieveName.Text.Trim(), Convert.ToInt32(Session["secrecyLevel"])); if (list != null) { Grid_AchieveAward.DataSource = list; Grid_AchieveAward.DataBind(); } } else if (page == 3) { List <Common.Entities.AchieveAward> list = award.FindByMember(tAchieveName.Text.Trim(), Convert.ToInt32(Session["secrecyLevel"])); if (list != null) { Grid_AchieveAward.DataSource = list; Grid_AchieveAward.DataBind(); } } else if (page == 4) { List <Common.Entities.AchieveAward> list = award.FindBySecrecyLevel(secrecyLevel.SelectedIndex + 1, Convert.ToInt32(Session["secrecyLevel"])); if (list != null) { Grid_AchieveAward.DataSource = list; Grid_AchieveAward.DataBind(); } } else { return; } pm.ExportExcel(3, Grid_AchieveAward, 1); } catch (Exception ex) { pm.SaveError(ex, this.Request); } }
//初始化界面 public void InitData() { try { ViewState["page"] = 0; List <Common.Entities.AchieveAward> list = award.FindPaged(Convert.ToInt32(Session["secrecyLevel"])); Grid_AchieveAward.RecordCount = list.Count(); if (list != null) { Grid_AchieveAward.DataSource = list.Skip(Grid_AchieveAward.PageIndex * Grid_AchieveAward.PageSize).Take(Grid_AchieveAward.PageSize); Grid_AchieveAward.DataBind(); } else { return; } } catch (Exception ex) { pm.SaveError(ex, this.Request); } }