Conditional HiddenInputAttribute

I need an attribute in the ASP.NET MVC view model that validates the specified condition (based on a different property value) and enables the on / off option of the visibility of the input control on the edit page.

Something like that:

public string SomeProperty { get; set; } [ConditionalHidden("SomeProperty", "PropertyValueToMakeConditionTrue")] public string DependentProperty { get; set; } 

Is it possible?

+4
source share
1 answer

If you need it after loading the page, you need javascript code.

Otherwise, you can use in sight

 @if(Model.Property == something) { html } 

But this is without an attribute.

0
source

All Articles