Wednesday 30 November 2016

MVC - TextBoxFor - Set default value

Watch this example on YouTube


Replace
 @Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } })

With
    @Html.TextBoxFor(model => model.FirstName, new {  @class = "form-control" , @Value="NO NAME" })

1 comment:

  1. @Html.TextBoxFor(a => a.ProductStatus, new {@class = "form-control", @Value="Ready", @readonly =true})

    Default value doesnt shown on google chrome and edge? What is problem


    ReplyDelete