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
Hi guys
I've been working on a calendar with special dates.
I added two date/time pickers for starting time and end time.
I want the end time only to be shown, if it has been filled out with a specific date. This is only for when the event duration is more than a day.
My code is as follows:
<div id="@item.Name" class="panel-collapse collapse"> @{ var children = item.Children().Where(x => x.IsVisible() && x.DocumentTypeAlias == "dag").ToList().OrderBy("startdato"); } @if (children.Any()) { <ul class="list-group"> @foreach (var subpage in children) { <li class="list-group-item"><p><span>@subpage.GetPropertyValue("maerkedag")</span><span>@(subpage.GetPropertyValue<DateTime>("startdato").ToString("dd/MM/yyyy"))</span> if(!subpage.GetPropertyValue("slutdato") == true){ <span style="display:none;"> - @(subpage.GetPropertyValue<DateTime>("slutdato").ToString("dd/MM/yyyy"))</span></p></li> } } </ul> } </div>
I took the if statement, from another project I did, but it doesnt seem to translate to what I need in this case.
Hope you guys can give me a push in the right direction
Best
Henrik
Hi Henrik
Could you please try this to see if it works for you
if(subpage.HasValue("slutdato")){ <span style="display:none;"> - @(subpage.GetPropertyValue<DateTime>("slutdato").ToString("dd/MM/yyyy"))</span></p></li> }
Hope this helps,
/Dennis
Hi Dennis
Thank you very much!
After rearranging my code a bit I got it working with your suggestion.
This solution is way simpler than what I was trying to achieve with my first code.
So once again. Thank you very much.
Have a great one :)
Hi Henrik,
Great to hear that it worked for you. Happy that I could help you out.
Have a fantactic Friday and weekend.
All the best,
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Don't show date/time if empty
Hi guys
I've been working on a calendar with special dates.
I added two date/time pickers for starting time and end time.
I want the end time only to be shown, if it has been filled out with a specific date. This is only for when the event duration is more than a day.
My code is as follows:
I took the if statement, from another project I did, but it doesnt seem to translate to what I need in this case.
Hope you guys can give me a push in the right direction
Best
Henrik
Hi Henrik
Could you please try this to see if it works for you
Hope this helps,
/Dennis
Hi Dennis
Thank you very much!
After rearranging my code a bit I got it working with your suggestion.
This solution is way simpler than what I was trying to achieve with my first code.
So once again. Thank you very much.
Have a great one :)
Best
Henrik
Hi Henrik,
Great to hear that it worked for you. Happy that I could help you out.
Have a fantactic Friday and weekend.
All the best,
/Dennis
is working on a reply...