Hello, I am trying to convert an existing ASPX page to cshtml format.
The original ASPX looks something like this:
<%
if (!Model.ObjectList.Any())
{
%>
<tr>
<td>No data found</td>
</tr>
<%
}
The equivalent Razor version looks like this:
@if (!Model.ObjectList.Any())
{
<tr>
<td>No data found</td>
</tr>
}
While the original syntax works just fine, the equivalent fails with the following message
'System.Collections.Generic.List' does not contain a definition for 'Any'
I was wondering
a) why this is happening and
b) how to resolve this issue. I've added a reference to the System.LINQ namespace in my CSHTML file but to no avail.
Any help is much appreciated,
JP