The disable property isn't true \ false, but should just read as disabled....e.g
@Html.TextBox("txtIden1", new { disabled="disabled" })
You don't set this in a controller, your controller is responsible for returning a model to the view that dictates how it should be rendered. So, in your controller method
public class SomeModel
{
public string SomeName {get; set;}
public bool FieldIsDisabled {get; set;}
}
public ActionResult GetMyModel()
{
var model = new SomeModel
{
SomeName = "Test",
FieldIsDiabled = true
}
return View(model);
}
@model SomeModel
@{
ViewBag.Title = "Home Page";
}
@Html.TextBoxFor(model => model.SomeName, model.FieldIsDiabled ? (object)new { disabled="disabled" } : new {})