I am trying to check the listedPublishDate value of children, if the listedPublishDate equals today then for every page that matches the date, display contents of that child; if a page does not exist with the matching listedPublishDate date then I would like to have hardcoded text. Something like this:
var displayDate = DateTime.Today.ToString("MMM d, yyyy");
Check date value of child
I am trying to check the listedPublishDate value of children, if the listedPublishDate equals today then for every page that matches the date, display contents of that child; if a page does not exist with the matching listedPublishDate date then I would like to have hardcoded text. Something like this:
var displayDate = DateTime.Today.ToString("MMM d, yyyy");
@if (CurrentPage.Children.Where("listedPublishDate == displayDate"))
{
@foreach (var page in pages)
{
@page.Name
@page.Content
}
else
{
Hello World
}
}
Thanks in advance,
Chrys
Hi Chrys,
Welcome to Our!
You are very close already but a few tweaks below for you:
I've assumed in this snippet that listedPublishDate is a Date Picker property editor.
Jeavon
is working on a reply...