Conditional HiddenInputAttribute
I need an attribute in ASP .NET MVC view model, which check the specif开发者_运维问答ied condition (based on another property value) and turn on/off visibility parameter of input control on edit page.
Something like that:
public string SomeProperty { get; set; }
[ConditionalHidden("SomeProperty", "PropertyValueToMakeConditionTrue")]
public string DependentProperty { get; set; }
Is it possible?
If you need it after page is loaded then you need javascript code.
Else you can use in view
@if(Model.Property == something)
{
html
}
But this is without attribute.
精彩评论