Hi
in my asp.net core razor pages project, in my index page, i have a simple code as follow :
if (Model._attachments.Count == 0)
{
await Component.InvokeAsync("NoData");
}
else
{
<div style="height: 100vh;" class="d-flex flex-column justify-content-between">
...
</div>
}
In my above code, i have a property named '_attachments' which returns from my dbContext. Now, before i show main content, check _attachment property count, If it's count == 0, then display my custom viewComponent named 'NoData'. my problem is that it display a blank page when _attachment.count == 0!
Here is my viewComponent code :
<div class="container font-iranSans mt-5" dir="rtl">
<a href="http://www.iranhealth.net" class="text-decoration-none">
<p>شبکه سلامت ایران</p>
</a>
<hr />
<div class="container text-center">
<img class=" img-fluid imgCustom" src="img/IranHealthLogo.png" alt="شبکه سلامت ایران">
</div>
<div class="alert alert-danger mx-auto mt-2 w-50 text-center pt-4">
<p>اطلاعاتی برای نمایش وجود ندارد!</p>
</div>
<div class="container text-center footerBox rounded-2 pt-1 mt-5">
<a href="http://www.iranhealth.net" class="text-decoration-none">
<p>IranHealth.net</p>
</a>
</div>
</div>
Where is the problem & how to solve it?
Thanks in advance