private HtmlGenericControl GetDivContainer(SectionItem section, int itemId) { HtmlGenericControl blockNews = new HtmlGenericControl("div"); blockNews.ID = "blockNews" + section.GuidID; blockNews.Attributes.Add("class", "block-news mrg-top"); HtmlGenericControl headControl = new HtmlGenericControl("div"); headControl.ID = "headControl" + section.GuidID; headControl.Attributes.Add("class", "block-head"); HtmlGenericControl h1Control = new HtmlGenericControl("h1"); h1Control.ID = "h1Control" + section.GuidID; h1Control.InnerText = section.SectionName; headControl.Controls.Add(h1Control); blockNews.Controls.Add(headControl); HtmlGenericControl txtWrapper = new HtmlGenericControl("div"); txtWrapper.ID = "txtWrapper" + section.GuidID; txtWrapper.Attributes.Add("class", "txt-wrapper clear"); containers.Add(txtWrapper); blockNews.Controls.Add(txtWrapper); this.Controls.Add(blockNews); //this.Controls.Add(blockNews); return blockNews; }
private ASPxDataView GetDataView(SectionItem item, int itemId) { ASPxDataView dv = new ASPxDataView(); dv.ID = "DV_" + itemId; dv.Height = new Unit("100%"); dv.Width = new Unit("100%"); dv.ItemSpacing = new Unit("0px"); dv.PagerSettings.EndlessPagingMode = DataViewEndlessPagingMode.OnClick; //dv.EnableCallbackAnimation = true; dv.ItemSpacing = new Unit("0px"); //dv.EnableTheming = false; //dv.EnableDefaultAppearance = false; dv.Paddings.Padding = new Unit("0px"); dv.ContentStyle.Paddings.Padding = new Unit("0px"); dv.ItemStyle.Paddings.Padding = new Unit("0px"); dv.ItemStyle.Height = new Unit("0px"); dv.Theme = "Moderno"; dv.PagerSettings.ShowMoreItemsText = "تحميل أكثر"; dv.RightToLeft = DevExpress.Utils.DefaultBoolean.True; dv.SettingsTableLayout.ColumnCount = 1; dv.SettingsTableLayout.RowsPerPage = 10; return dv; }
private void LoadDataControls() { descLength = 30; string code = Request["sections"]; if (string.IsNullOrEmpty(code)) { code = Page.RouteData.Values["sections"].ToString(); } var sections = (from x in Articles select x.SectionName).Distinct(); int itemid = 1; foreach (string section in sections) { SectionItem item = new SectionItem(); item.SectionName = section; item.Articles = (from x in Articles where x.SectionName == section select x).ToList(); SectionItems.Add(item); MainContainer.Controls.Add(GetDivContainer(item,itemid)); MainContainer.DataBind(); itemid++; } itemid = 1; foreach (SectionItem section in SectionItems) { ASPxDataView dv = GetDataView(section, itemid); containers[itemid - 1].Controls.Add(dv); dv.ItemTemplate = new ListItemTemplate(Articles); dv.DataSource = (from x in Articles where x.SectionName == section.SectionName select x).ToList(); dv.DataBind(); itemid++; } int i = ArticlesList.Count(); foreach(BusinessLogicLayer.Entities.ContentManagement.Article a in Articles) { if (i == 10) break; i++; ArticlesList.Add(a); } ListNewsContainer.DataSource = ArticlesList; ListNewsContainer.DataBind(); //SectionsRepeater.DataSource = SectionItems; //SectionsRepeater.DataBind(); }
private HtmlGenericControl LoadContainers(SectionItem item) { HtmlGenericControl blockNews = new HtmlGenericControl("div"); blockNews.ID = "blockNews" + item.GuidID; blockNews.Attributes.Add("class", "block-news mrg-top"); HtmlGenericControl headControl = new HtmlGenericControl("div"); headControl.ID = "headControl" + item.GuidID; headControl.Attributes.Add("class", "block-head"); HtmlGenericControl h1Control = new HtmlGenericControl("h1"); h1Control.ID = "h1Control" + item.GuidID; h1Control.InnerText = item.SectionName; headControl.Controls.Add(h1Control); blockNews.Controls.Add(headControl); HtmlGenericControl txtWrapper = new HtmlGenericControl("div"); txtWrapper.ID = "txtWrapper" + item.GuidID; txtWrapper.Attributes.Add("class", "txt-wrapper clear"); containers.Add(txtWrapper); blockNews.Controls.Add(txtWrapper); return blockNews; }
private void LoadDataControls() { descLength = 30; string code = Request["key"]; if (string.IsNullOrEmpty(code)) { code = Page.RouteData.Values["key"].ToString(); } var sections = (from x in Articles select x.SectionName).Distinct(); int itemid = 1; SectionItems.Clear(); SectionItem item = new SectionItem(); item.SectionName = " بحث:" + code; item.Articles = Articles; SectionItems.Add(item); MainBlockContainer.Controls.Add(GetDivContainer(item, itemid)); MainBlockContainer.DataBind(); itemid = 1; foreach (SectionItem section in SectionItems) { ASPxDataView dv = GetDataView(section, itemid); containers[itemid - 1].Controls.Add(dv); dv.ItemTemplate = new ListItemTemplate(Articles); dv.DataSource = Articles; dv.DataBind(); itemid++; } //SectionsRepeater.DataSource = SectionItems; //SectionsRepeater.DataBind(); }