You can check for null and execute your script.
@if (ViewBag.YourKey== null)
{
//your code
}
This will check that ViewBag.YourKey is null if you want to check it for not null you can change the if condition.
You can check for null and execute your script.
@if (ViewBag.YourKey== null)
{
//your code
}
This will check that ViewBag.YourKey is null if you want to check it for not null you can change the if condition.