asp.net mvc - MVC how to check for NULL in model.property -
in razor-view, how can check existence of property in model?
if (model._myprop != null) <--- error .runtimebinder.runtimebinderexception if model not contain _myprop { ...do }
you not want check 1 of model's properties has value null want check type having property or not , ofcourse solution not work way @satpal's wont work too.
use stronly typed views , separate different properties interfaces , use them partial views.
Comments
Post a Comment