How do I get the value of an @Html.TextBoxFor for an Input? asp.net mvc

0

I want to get the value that is in the @Html.TextBoxFor is to add in the input

<div class="col-md-3 form-group">
<label>Multiplicador 01:</label>
<input class="form-control input-sm" autocomplete="off" value= @Html.TextBoxFor(c => Model.VALOR01) type="number" ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/" step="0.01" id="valor1" name="valor1">

    
asked by anonymous 02.08.2016 / 02:42

2 answers

1

@itasouza, I believe that in this case you can use @Html.EditorFor, setting the type of it to number, would look something like this:

@Html.EditorFor(Model => Model.VALOR01 , new { @type = "number", @id= "valor1", @step = "0.01", @name="valor1", @autocomplete="off"})

I hope I have helped.

Abs

    
02.08.2016 / 15:11
0

@Html.TextBoxFor() generates a new <input> for you. The correct is to directly pick up the Model value:

<input class="form-control input-sm" autocomplete="off" value="@Model.VALOR01" type="number" ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/" step="0.01" id="valor1" name="valor1">
    
04.08.2016 / 18:15