Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @using ClientDependency.Core.Mvc; @using System.Web.Mvc; @using System.Web.Mvc.Html; @using Umbraco.Core.Models; @using System.Linq; @{ Layout = "WebPage.cshtml"; ViewBag.footertype = "skew";
int pageSize = 10; int page = 1; if (!String.IsNullOrEmpty(Request.QueryString["p"])) { try { page = int.Parse(Request.QueryString["p"]); } catch (Exception ex) { page = 1; } } IPublishedContent ArticleSection = Model.Content.AncestorOrSelf(2).DescendantsOrSelf("ArticleList").SingleOrDefault(); IEnumerable<IPublishedContent> AllArticles = ArticleSection.Children.Where(x => x.IsVisible()).ToList(); IEnumerable<IPublishedContent> FilteredArticles = AllArticles; int count = FilteredArticles.Count(); if (Model.Content.DocumentTypeAlias == "ArticleCategory") {
FilteredArticles = FilteredArticles.Where(x => x.GetPropertyValue<>
<div class="row"> @Html.Partial("blog/Pager", Model.Content, new ViewDataDictionary { { "count", count }, { "pageSize", pageSize } }) </div> </div> </div> </div> </section>
}
On arrow for previous and next current i can only view 3 article i would like to be able to view at least more than 5 article.
Please help
Hi Emmanuel, seems the critical part is not visible due to copy / paste issue with the blog engine. Struggled on my own with this;-)
So, please send the following line again:
The issue must be cause in this line I think. Two things appear already strange to me:
In general - I guess - you should use:
var pageFilteredArticles = FilteredArticles.Skip(p * pageSize).Take(pageSize); @foreach(avr article in pageFilteredArticles) {...
To get the articles per page.
Yours Dirk
var firstOrDefault = new ArticlePost(newsArticleList.FirstOrDefault()); var lastItem = new ArticlePost(newsArticleList.LastOrDefault());
previous arrow and next arrow for view articles
FilteredArticles = FilteredArticles.Where(x => x.GetPropertyValue<List<IPublishedContent>>("categories").Exists(element => element.Id == Model.Content.Id));
@foreach (IPublishedContent post in FilteredArticles.<DateTime>(x => x.GetPropertyValue("publishedDate")).Skip(page * pageSize).Take(pageSize)) { var categories = post.GetPropertyValue<IEnumerable<IPublishedContent>>("categories");
Hi Dirk Seefeld
Below is the line u have ask:
previous arrow(is using method for FisrtOrDefault) Next Arrow( using method for LastOrDefault)
if you clicks on arrow next it jumps articles and takes the 2 last article- I want this to open the next article
if you clicks on arrow previous it jumps articles and takes the first article or recent article only- I want this to open the previous article
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How can i list 5 articles currently now i can view 3 below is the code i have don
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @using ClientDependency.Core.Mvc; @using System.Web.Mvc; @using System.Web.Mvc.Html; @using Umbraco.Core.Models; @using System.Linq; @{ Layout = "WebPage.cshtml"; ViewBag.footertype = "skew";
FilteredArticles = FilteredArticles.Where(x => x.GetPropertyValue<>
}
On arrow for previous and next current i can only view 3 article i would like to be able to view at least more than 5 article.
Please help
Hi Emmanuel, seems the critical part is not visible due to copy / paste issue with the blog engine. Struggled on my own with this;-)
So, please send the following line again:
The issue must be cause in this line I think. Two things appear already strange to me:
In general - I guess - you should use:
To get the articles per page.
Yours Dirk
var firstOrDefault = new ArticlePost(newsArticleList.FirstOrDefault()); var lastItem = new ArticlePost(newsArticleList.LastOrDefault());
previous arrow and next arrow for view articles
Hi Dirk Seefeld
Below is the line u have ask:
FilteredArticles = FilteredArticles.Where(x => x.GetPropertyValue<>
previous arrow(is using method for FisrtOrDefault) Next Arrow( using method for LastOrDefault)
if you clicks on arrow next it jumps articles and takes the 2 last article- I want this to open the next article
if you clicks on arrow previous it jumps articles and takes the first article or recent article only- I want this to open the previous article
is working on a reply...