List Items greater than or equal to current datetime
I'm sure this has to be a simple syntax problem but I just can't seem to get it working. I'm simply pulling a list of events and want to leave off any events occuring in the past. This is on a partial view macro file:
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@if (Model.MacroParameters["startNodeID"] != null)
{
@* Get the start node as a dynamic node *@
var startNode = Umbraco.Content(Model.MacroParameters["startNodeID"]);
if (startNode.Children.Where("Visible").Any())
{
Upcoming Training
@foreach (var page in startNode.Children.Where("Visible").OrderBy("startdate"))
{
I was hoping I could add some logic to the foreach loop but can't crack the syntax and can't find a good example online. If anyone could help out or point me in the right direction.
List Items greater than or equal to current datetime
I'm sure this has to be a simple syntax problem but I just can't seem to get it working. I'm simply pulling a list of events and want to leave off any events occuring in the past. This is on a partial view macro file:
@if (Model.MacroParameters["startNodeID"] != null) { @* Get the start node as a dynamic node *@ var startNode = Umbraco.Content(Model.MacroParameters["startNodeID"]);
Upcoming Training
@foreach (var page in startNode.Children.Where("Visible").OrderBy("startdate")) {- @page.Name
}
@page.startdate.ToString("F")
}
I was hoping I could add some logic to the foreach loop but can't crack the syntax and can't find a good example online. If anyone could help out or point me in the right direction.
thanks
Looks like the markdown editor jacked with the code. the part I was looking into was the foreach loop
How do i add another where statement saying that startdate needs to be greater than or equal to the current datetime
thanks
Hi Brian,
Have you tried something like this:
Hope this helps,
/Dennis
Very nearly Dennis,
I think it needs to be like this
Jeavon
BAM....worked perfect..Thanks so much Jeavon
Awesome! You're very welcome Brian.
is working on a reply...