Ejemplo n.º 1
0
        //Load
        public int LoadHoatDong()
        {
            List<HOATDONG> lt = new List<HOATDONG>();

            BUSHoatDong BUSHoatDong = new BUSHoatDong();

            lt = BUSHoatDong.SelectHOATDONGsAll();
            if (lt.Count > 0)
            {
                this.GridViewHoatDong.DataSource = lt;
                GridViewHoatDong.DataBind();
                PanelDanhSach.Visible = true;
                PanelMessage.Visible = false;

                return lt.Count;
            }
            else
            {
                PanelDanhSach.Visible = false;
                PanelMessage.Visible = true;
                return 0;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //Thong tin nguoi dung

            BUSHoatDong HoatDongBUS = new BUSHoatDong();
            List<HOATDONG> DSHoatDong = HoatDongBUS.SelectHOATDONGsAll();
            drlHoatDong.DataSource = DSHoatDong;
            drlHoatDong.DataTextField = "TenHoatDong";
            drlHoatDong.DataValueField = "MaHoatDong";
            drlHoatDong.DataBind();

            if (Request.QueryString["id"] != null)
            {
                //lay ma
                int mahoatdong = int.Parse(Request.QueryString["id"]);

                //lay thong tin va load len cac textbox
                BUSThongBao BUSThongBao = new BUSThongBao();
                THONGBAO lpDTO = BUSThongBao.TimKiem(mahoatdong);
                txttieude.Text = lpDTO.TieuDe ;
                txtnoidung.Content = lpDTO.NoiDung ;
                drlHoatDong.SelectedValue = mahoatdong.ToString();
            }
        }