开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜