|
-
Feb 3rd, 2015, 03:28 PM
#1
Thread Starter
Member
How to check if ViewBag has a certain dynamically created property or not?
Folks,
Suppsoe that a certain dynamic property of a ViewBag object is optional. How can I check whether it has been created or not?
My first reaction is to check for null value.
Code:
@if (ViewBag.OptProp != null) {...}
But then how to handle the case when the property has been actually created, but the value assigned to it is null ?
Any suggestion, insight or reference is really appreciated!
Cheers,
- Nick
p.s. I think, my question is similar to this one: How do I check if an object has a property in JavaScript?. Except mine is about .NET .
Last edited by kender; Feb 3rd, 2015 at 04:07 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|