从属性传递给mvc html helper

时间:2016-02-18 12:56:10

标签: asp.net asp.net-mvc data-annotations unobtrusive-validation

我想拥有以下poco对象:

public int Age { get; set; }

[Disabled(Operator.LessThan, "Age", 18)]
public string Country { get; set; }

然后在前端我想生成以下内容:

Html.TextBoxFor(model => model.Country) 

//如果年龄小于18,则应禁用文本框(获取禁用的attr)。

在年龄字段上拥有onchange的soimekind也很高兴,以便通过javascript禁用文本框国家/地区。

0 个答案:

没有答案
相关问题