Si Viewbag est nul

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