I am new to Umbraco.
I have created two properties Event Start Date and Event End Date with the Date picker. I wish to hide the End Date if the field is empty. ie the event is only a single day. Currently it displays Monday 01/01/0001 if it is left empty. How do I do that?
Hide date field if empty
I am new to Umbraco. I have created two properties Event Start Date and Event End Date with the Date picker. I wish to hide the End Date if the field is empty. ie the event is only a single day. Currently it displays Monday 01/01/0001 if it is left empty. How do I do that?
Hi Mark
What you can do is use the method called HasValue() this will only print the value out if there is one
It looks something like this
@if(Model.Content.HasValue(eventEndDate)){
Do something if the field has a value
}
Remember ro change the eventEndDate so it match your field alias
Hope this helps,
/Dennis
Thanks Dennis
But I could not work out how to get this to work.
Original
What I tried
@if(item.HasValue(“eventEndDate”)){
// output the value from the date picker here
}
If eventEndDate now has a value then it will be printed out
Hope this helps
/Dennis
is working on a reply...