I want to be able to show data if an integer is not null. However, if is null I get error
C#
@if (item.PTWSubsequent.PTWNoS != 0)
{
@Html.DisplayFor(model => item..PTWNoS)
}and code behind
C#
PTWContentList = await _context.PTWContents.Include(s => s.PTWMain).Include(s => s.PTWSubsequent).Where(s => s.PTWMain.OrgID == orgid).ToListAsync();I get the error that PTWNoS is null which I know is null. I just want to not show the div if is null


Sachin SinghRank #66 · 26.2K reputationPosted Sep 2, 2021, 3:05 PM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Sep 2, 2021, 3:11 PM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Sep 2, 2021, 2:53 PM EDT
Marius VasileRank #785 · 2.9K reputationPosted Sep 2, 2021, 2:56 PM EDT
Marius VasileRank #785 · 2.9K reputationPosted Sep 2, 2021, 3:07 PM EDT