const string vsKey = "searchCriteria"; //ViewState key /// <summary> /// 页面加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlactlist.Items.Clear(); SiteActivityDAL actDal = new SiteActivityDAL(); DataSet ds = new DataSet(); if (Session["strRoleCode"].ToString() == "ADMIN") { ds = actDal.GetActivityListByState(""); } else { ds = actDal.GetActivityListByState(" AND SiteCode ='" + Session["strSiteCode"].ToString() + "' "); } DataTable dt = ds.Tables[0]; DataRow dr = ds.Tables[0].NewRow(); dr["ID"] = ""; dr["ActTitle"] = "--全部--"; dt.Rows.InsertAt(dr, 0); ddlactlist.DataSource = ds.Tables[0].DefaultView; ddlactlist.DataTextField = "ActTitle"; ddlactlist.DataValueField = "ID"; ddlactlist.DataBind(); AspNetPager1.CurrentPageIndex = 1; string s = ""; if (Session["strRoleCode"].ToString() != "ADMIN") { s = " AND b.SiteCode = '" + Session["strSiteCode"].ToString() + "' "; } ViewState[vsKey] = s; LoadData(s); } }
/// <summary> /// 页面加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Session["strSiteCode"].ToString()) && Session["strRoleCode"].ToString() != "ADMIN") { Response.Write("<script language=JavaScript>parent.location.href='../Index.aspx';</script>"); Response.End(); } if (!IsPostBack) { #region 初始化界面 ddlactlist.Items.Clear(); SiteActivityDAL actDal = new SiteActivityDAL(); DataSet ds = new DataSet(); if (Session["strRoleCode"].ToString() == "ADMIN") { ds = actDal.GetActivityListByState(""); } else { ds = actDal.GetActivityListByState(" AND SiteCode ='" + Session["strSiteCode"].ToString() + "' "); } DataTable dt = ds.Tables[0]; DataRow dr = ds.Tables[0].NewRow(); dr["ID"] = ""; dr["ActTitle"] = "--全部--"; dt.Rows.InsertAt(dr, 0); ddlactlist.DataSource = ds.Tables[0].DefaultView; ddlactlist.DataTextField = "ActTitle"; ddlactlist.DataValueField = "ID"; ddlactlist.DataBind(); awardsort.Items.Add(new ListItem("大转盘", "0")); awardsort.Items.Add(new ListItem("刮刮奖", "1")); if (null != Common.Common.NoHtml(Request.QueryString["action"])) { strAction = Common.Common.NoHtml(Request.QueryString["action"]); } if (null != Common.Common.NoHtml(Request.QueryString["id"])) { strID = Common.Common.NoHtml(Request.QueryString["id"]); } #endregion } }