Line breaks in table cells ASP.NET MVC C#

Asked

Viewed 558 times

0

How to do not break in multiple rows the columns of a <table>, because I put a scroll and would like to leave the grid cells without breaking, and rather let the user use the scroll.

inserir a descrição da imagem aqui

View Table

@model IEnumerable<Projeto.ERP.Model.Model.Cadastros.Pessoas.PessoaModel>
@using PagedList.Mvc;
@using PagedList;
@{
    ViewBag.Title = "GridViewMvc";
}

<h2>GridViewMvc</h2>

<div style="overflow: auto; width: 1140px">
    <table class="table table-striped table-bordered table-responsive table-hover">
        <thead>
            <tr>
                <th>
                    @Html.DisplayNameFor(model => model.Descricao)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.CPF)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.RG)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Logradouro)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Numero)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Complemento)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Bairro)
                </th>
                <th>
                    @Html.DisplayName("País")
                </th>
                <th>
                    @Html.DisplayName("Estado")
                </th>
                <th>
                    @Html.DisplayName("Cidade")
                </th>
                <th>
                    @Html.DisplayName("País")
                </th>
                <th>
                    @Html.DisplayName("Estado")
                </th>
                <th>
                    @Html.DisplayName("Cidade")
                </th>
            </tr>
        </thead>
        <tbody>

            @foreach (var registro in Model.ToList())
            {
            <th>
                @registro.Descricao
            </th>
            <th>
                @registro.CPF
            </th>
            <th>
                @registro.RG
            </th>
            <th>
                @registro.Logradouro
            </th>
            <th>
                @registro.Numero
            </th>
            <th>
                @registro.Complemento
            </th>
            <th>
                @registro.Bairro
            </th>
            <th>
                @registro.Pais.Descricao
            </th>
            <th>
                @registro.Estado.Descricao
            </th>
            <th>
                @registro.Cidade.Descricao
            </th>
            <th>
                @registro.Pais.Descricao
            </th>
            <th>
                @registro.Estado.Descricao
            </th>
            <th>
                @registro.Cidade.Descricao
            </th>
            }

            </tbody>
        </table>
        @if (ViewBag.PageCount > 1)
        {
            <div class="row">
                <div class="offset1 span10 font-small">
                    Pag: @(ViewBag.PageCount < ViewBag.PageNumber ? 0 : ViewBag.PageNumber) de @ViewBag.PageCount
                    @Html.PagedListPager((IPagedList)Model, page => Url.Action("Index", new { page, sortOrder = ViewBag.CurrentSort, searchString = ViewBag.CurrentSearch }))
                </div>
            </div>
        }

    </div>

1 answer

0

You can do this using CSS

table{
    white-space: nowrap;
}

Browser other questions tagged

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