private void LoadData(DataClassesDatabaseDataContext db) { RepeaterPage.DataSource = db.TBPages .Select(item => new { IDPage = item.IDPage, Nama = item.Nama, Template = item.TBPageTemplate.Nama, Count = item.TBPosts.Count(), Body = item.TBPosts.Select(item2 => new { IDPage = item2.IDPage, IDPost = item2.IDPost, Judul = item2.Judul, Deskripsi = item2.Deskripsi, PostDetail = GetAllPostDetail(item2), Urutan = item2.Urutan, VisibleHapus = item2.TBPostDetails.Count == 0 ? true : false }).OrderBy(item2 => item2.Urutan), }) .OrderByDescending(item => item.Nama) .ToArray(); RepeaterPage.DataBind(); }
private void fillData() { DataSourceSelectArguments args = new DataSourceSelectArguments(); DataView view = (DataView)JesusIsKingDatabase.Select(args); DataTable dt = view.ToTable(); PagedDataSource page = new PagedDataSource(); page.DataSource = view; page.AllowPaging = true; page.PageSize = 7; page.CurrentPageIndex = PageNumber; Repeater1.DataSource = page; Repeater1.DataBind(); if (page.PageCount > 1) { RepeaterPage.Visible = true; ArrayList arraylist = new ArrayList(); for (int i = 0; i < page.PageCount; i++) { arraylist.Add((i + 1).ToString()); } RepeaterPage.DataSource = arraylist; RepeaterPage.DataBind(); } else { RepeaterPage.Visible = false; } }
private void LoadPost() { using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext()) { if (DropDownListPage.SelectedValue != "0") { var ListPost = db.TBPosts.Where(item => item.IDPage == DropDownListPage.SelectedValue.ToInt()).Select(item => new { Urutan = item.Urutan, Post = item.Judul, Align = item.Align, Deskripsi = item.Deskripsi, Count = item.TBPostDetails.Count, Body = item.TBPostDetails.Select(item2 => new { item2.IDPostDetail, ClassButton = Manage.HTMLJenisPostDetailButton(item2.Jenis), Urutan = item2.Urutan, Pegawai = item2.TBPengguna.NamaLengkap, Tanggal = item2.Tanggal, Nama = item2.Nama, Jenis = item2.Jenis, JenisBadge = Manage.HTMLJenisPostDetail(item2.Jenis), Konten = item2.Konten, Images = item2.TBPostDetailImages }).OrderBy(item2 => item2.Urutan) }).OrderBy(item => item.Urutan); RepeaterPage.DataSource = ListPost; RepeaterPage.DataBind(); RepeateraLayout.DataSource = ListPost; RepeateraLayout.DataBind(); DivAlertSwap.Attributes.Add("class", "alert alert-primary"); LabelAlert.Text = "Pilih post yang akan di swap"; } else { RepeaterPage.DataSource = null; RepeaterPage.DataBind(); RepeateraLayout.DataSource = null; RepeateraLayout.DataBind(); DivAlertSwap.Attributes.Add("class", "alert alert-info"); LabelAlert.Text = "Pilih page layout"; } } }