Bootstrap class does not work with htmlhelper

Asked

Viewed 159 times

1

I am now starting to work with MVC, Razor, Bootstrap etc., and am having a design problem.

These 2 textarea are using the same classes, everything is the same, except that in one I carry value of my model, so I have to use html helper, and the bottom one is pure html.

        <div class="form-group">          
            <div class="col-lg-10">
                @Html.TextAreaFor(model => model.Definicao, 5, 45, new { htmlAttributes = new { @class = "form-control" } })            
            </div>
        </div>

        <div class="form-group">         
            <div class="col-lg-10">
                <textarea class="form-control" name="model.Definicao" rows="5" cols="45" ></textarea> 
            </div>
        </div> 

Where do I use the helper css class does not load into my form, someone knows if this is a bug or I’m doing something wrong?

1 answer

1


Try the following:

@Html.TextAreaFor(model => model.Definicao, new { @class = "form-control",  rows="20", @cols="50" })

Browser other questions tagged

You are not signed in. Login or sign up in order to post.