How can I do this in Razor #17604
Unanswered
RemcoW2002
asked this question in
Q&A
Replies: 1 comment
-
There's @if (Model.SearchResults is null)
{
<div class="alert alert-primary">No results found.</div>
}
else
{
....
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Might be a bit of a nooby question again but I can't figure out to check if the count of contentItem is above 0 in the Search-Results.cshtml:
I've tried Count, Length, Size, HasItems which of course doesn't work.
Also this is one of the places in the docs where I think a razor example is missing:
https://docs.orchardcore.net/en/main/guides/implement-fulltext-search/#:~:text=FlowPart.Widgets%20%7C%20full_text_aspect%20%7D%7D-,Optional%20%3A%20Search%20templates%20customization,-%C2%B6
As you can see in the above this is how it's done in liquid:
Edit: I've currently fixed this by doing this, but surely there is a better way?
Beta Was this translation helpful? Give feedback.
All reactions