Se Viewbag for nulo

@if (ViewBag.YourKey== null)
{
 //your code   
}
Mahmoud Nasr