Hi guys, i'm trying to display a field only if it's not empty. It works when not empty, but I got a macro error when empty. So, if in the foreach there's a result with empty "matiere", I got a error...
What I do wrong?
@foreach (var r in results.Skip(currentPage*10).Take(10)) { <p> <a href="@umbraco.library.NiceUrl(r.Id)"><strong>@r.Fields["nodeName"]</strong></a><br /> <small>Matière : if(!String.IsNullOrEmpty(@r.Fields["matiere"])){@r.Fields["matiere"]}</small> </p> }
if field is not empty
Hi guys, i'm trying to display a field only if it's not empty. It works when not empty, but I got a macro error when empty. So, if in the foreach there's a result with empty "matiere", I got a error...
What I do wrong?
Ok, got it working :
is working on a reply...