2
如何在mvc3控制器中啓用和禁用@html.textbox
?如何在mvc3控制器中爲@ html.textbox啓用和禁用
我的文本框代碼:
@Html.TextBox("txtIden1")
點擊按鈕後,我怎麼可以禁用或啓用控制器文本框。
我寫的按鈕單擊事件代碼控制,如下面
@using(Html.BeginForm())
{
@Html.TextBox("txtCustomerFilter");
}
<button name="button" value="Submit">Save</button>
<button name="button" value="cancel">Cancel</button>
控制器:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Customer(string button,
customer customerInsert, FormCollection formvalues)
{
if(button == "Submit")
{
//Code
}
else
{
//Code
}
return View();
}
是否可以有一個屬性總是和其他可選?如: '@ Html.TextBoxFor(x => x.AddFirstLine,Model.AutomaticAddress? new {'@class =「form-control」,'@disabled =「disabled」}:new {@class =「 form-control「}) – Juan