Build.Mvc is a helper extensions method library that turns the standard ASP .NET MVC HtmlHelper methods into jQuery-style chainable methods that allow you to expressively add markup and style to your MVC application.
Build.Mvc is available on NuGet
@if (Model.DateOfBirth.HasValue)
{
@Html.TextBoxFor(m => m.DateOfBirth, String.Format("{0:d}", Model.DateOfBirth) ,new { @class = "ui-datepicker span11", @style = "display:block;float:left;" })
}
else
{
@Html.TextBoxFor(m => m.DateOfBirth, new { @value = "", @class = "ui-datepicker span11", @style = "display:block;float:left;" ,@readonly="readonly"})
}
@Html.BuildTextBoxFor(m => m.DateOfBirth, string.Format("{0:d}", Model.DateOfBirth)).BuildWith(
b => b.AddClass("ui-datepicker", "span11").
Css("display", "block").
Css("float", "left").
BuildWhen(Model.DateOfBirth == null, t =>
t.Attr("value", "").
Attr("readonly", "readonly")
))
View the project on CodePlex for more complete documentation.
- SocialGoal is a MVC 5, EF6 Reference App