Check Model in mvc4 views
How to check whether the model is empty or not in mvc4 views?..
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Anubhav ChaudharyRank #29 · 42K reputationPosted Dec 4, 2013, 12:20 AM EST
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.
Jignesh TrivediRank #16 · 50.3K reputationPosted Dec 4, 2013, 7:07 PM EST
hi,
in view bind Model is available in "MOdel" variable so ...
try
@model IEnumerable
@if (Model == null)
{
// do soming....
}
hope this will help you.