var child = @Library.MediaById(3352).Children.FirstOrDefault(); if (child != null) { //do something if there was something in the list } else { //do something if there wasn't anything in the list }
Our original script works. What we determined with aid of the debugger was that the mini profiler was throwing errors, once we uninstalled that package the script ran without issue. We don't know why that fixed it, but we know it did.
.Children.First()
We are writing a razor script to pull the first child under a media folder. We are using this code, but it keeps throwing an error. Any advice?
this should work if the mediaById call has worked
Our original script works. What we determined with aid of the debugger was that the mini profiler was throwing errors, once we uninstalled that package the script ran without issue. We don't know why that fixed it, but we know it did.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.