Check Model in mvc4 views
How to check whether the model is empty or not in mvc4 views?..
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Dec 5, 2013, 12:07 AM
hi,
in view bind Model is available in "MOdel" variable so ...
try
@model IEnumerable
@if (Model == null)
{
// do soming....
}
hope this will help you.
Anubhav ChaudharyPosted Dec 4, 2013, 5:20 AM
Now if your Model contains anything about "abc" then your View will automatically display abc on putting the dot(.) after m, and if it doesn't show anything then you will automatically get to know that there is nothing in the Model.