0

I have code below that creates form with a Dropdown and edit. How can I set width for each individually.

@using (Html.BeginForm())
{
    <div class="form-horizontal" style="background-color:azure">
         <div class="form-group">
            @Html.LabelFor(model => model.EmployeeID, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("EmployeeID", null, htmlAttributes: new { @class = "form-control" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })                
            </div>
        </div>
    </div>
}

I tried below , but it dosen't work.

 @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control", style = "Width:250px"  } })
ary
  • 939
  • 2
  • 13
  • 32

1 Answers1

0

You are using Bootstrap, why not use it to control the size? Here is an answer about it. Input widths on Bootstrap 3

Or you can create a class with defined sizes and apply these classes.

Community
  • 1
  • 1
Luiz
  • 542
  • 5
  • 10