Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["loginName"] == null)
            {
                //Response.Write("<script>this.parent.location.href='../Default.aspx'</script>");
                Response.Redirect("~/Default.aspx");
                return;
            }
            DataTable dtNotice = notce.SelectAllNotice();

            DataList1.DataKeyField      = "noticeID";
            myPagenavigate1.Pager_Size  = 4;         //设定DataList控件每页要显示的数据条数
            myPagenavigate1.myDataGrid  = DataList1; //指定义要实现分页功能的DataList
            myPagenavigate1.myDataTable = dtNotice;  //指定DataList数据源

            //if (Convert.ToBoolean(Session["IsSysManager"]) == false)
            //{
            //    //for (int i = 0; i < DataList1.Items.Count; i++)
            //    //{
            //    //    ((ImageButton)DataList1.Items[i].FindControl("ImageButton1")).Visible = false;
            //    //    ((ImageButton)DataList1.Items[i].FindControl("ImageButton2")).Visible = false;
            //    //}

            //    foreach (DataListItem item in this.DataList1.Items)
            //    {
            //        //Panel p = item.FindControl("Panel") as Panel;
            //        ((ImageButton)item.FindControl("ImageButton1")).Visible = false;
            //        ((ImageButton)item.FindControl("ImageButton2")).Visible = false;
            //    }
            //}
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            notice notce = new notice();

            DataList1.DataSource = notce.SelectAllNotice();
            DataList1.DataBind();
        }