コード例 #1
0
 public void LoadImage()
 {
     BUSLoaiHoatDong busLoaiHD = new BUSLoaiHoatDong();
     LOAIHOATDONG aLoaiHD = busLoaiHD.TimKiem("Hoạt động nổi bật");
     if (aLoaiHD != null)
     {
         BUSHoatDong busHD = new BUSHoatDong();
         List<HOATDONG> dsHDNoiBat = busHD.LayHoatDongTheoLoai(aLoaiHD.MaLoaiHoatDong);
         if (dsHDNoiBat.Count > 0)
         {
             imgMain.ImageUrl = "~/Uploads/HinhAnhHoatDong/" + dsHDNoiBat[0].HinhAnh;
             imgMain.AlternateText = "Không tìm thấy hình ảnh";
             imgMain.PostBackUrl = "~/ChiTietHoatDong.aspx?id=" + dsHDNoiBat[0].MaHoatDong;
         }
     }
 }
コード例 #2
0
 protected void ddlLoaiHoatDong_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlLoaiHoatDong.SelectedIndex != -1)
     {
         int iMaLoai = int.Parse(ddlLoaiHoatDong.SelectedValue);
         BUSLoaiHoatDong busLoaiHD = new BUSLoaiHoatDong();
         LOAIHOATDONG LoaiTatCa = busLoaiHD.TimKiem("Tất Cả");
         if (LoaiTatCa != null && iMaLoai == LoaiTatCa.MaLoaiHoatDong)
         {
             int soDong = LoadHoatDong();
             FilterSTT(soDong, 0, int.Parse(DropDownListPaging.SelectedValue));
         }
         else
         {
             //Lấy hoạt động theo mã loại
             BUSHoatDong busHoatDong = new BUSHoatDong();
             List<HOATDONG> dsHoatDong = busHoatDong.LayHoatDongTheoLoai(iMaLoai);
             GridViewHoatDong.DataSource = dsHoatDong;
             GridViewHoatDong.AutoGenerateColumns = false;
             GridViewHoatDong.DataBind();
             this.FilterSTT(dsHoatDong.Count, GridViewHoatDong.PageIndex, int.Parse(DropDownListPaging.SelectedValue));
         }
     }
 }