Customize TextBoxFor Width

1

How to change the size of TextBoxFor ? I followed exactly that solution and it had no effect on my form: [ Defining a larger size for a TextBoxFor

The Bootstrap CSS file is being loaded before;

HTML:

@model Merc.Dominio.Entidade.Colaborador
@{
    ViewBag.Title = "COLABORADOR";
    Layout = "~/Areas/Administrativo/Views/Shared/_AdministrativoLayout.cshtml";
}
<style>
    .form-control-custom {
        width: 1000px;
    }
</style>
<input type="hidden" id="hidColaboradorID" name="hidColaboradorID" value="@Model.ColaboradorID" />
<div class="row">
    <div class="col-md-12">
        <fieldset>
            <legend>COLABORADOR - EDITAR</legend>

            <fieldset>
                <label><u>DADOS PESSOAIS:</u></label>
                <div class="row">
                    <div class="col-md-8">
                        @Html.LabelFor(x => x.Nome)
                        @Html.TextBoxFor(x => x.Nome, new { @class = "form-control form-control-custom"})
                    </div>

                    <div class="col-md-2">
                        <label>CPF</label>
                        @Html.TextBoxFor(x => x.CPFCNPJ, new { @class = "form-control" })
                    </div>
                    <div class="col-md-2">
                        <label id="RG" name="RG">RG</label>
                        @Html.TextBoxFor(x => x.RG, new { @class = "form-control" })
                    </div>

                </div>
            </fieldset>

        </fieldset>
    </div>
</div
    
asked by anonymous 19.09.2016 / 15:26

1 answer

1

Note that style of input is set to 250px:

<input class="form-control" id="Nome" name="Nome" style="width: 250px; height: 30px;" type="text" value="Benício Calebe Giovanni Araújo" />

As Bootstrap, just delete all information from style that the size of input is stretched to the largest possible width.

EDIT

style="min-width: 100%" is not a good way to solve. You solve the problem only for one component, which should solve for the entire application.

See also this answer .

    
19.09.2016 / 15:40