How to allow line breaking in gridview?

Asked

Viewed 2,175 times

2

I did a test in my Gridview writing the title of a book with many characters, what happened was the following: It expanded my grid beyond the page size, generating a layout break. My Gridview is with Width="100%". I tried to put it in the column ItemStyle-Wrap="False" but it didn’t work, how to solve?

GridView com quebra de layout

  • put your grid code.

1 answer

1

The solution is to define the following property in the column you want there to be line break:

 ItemStyle-Wrap="True"

Or simply don’t put any property. The default of GridView Asp.NET is to break. If you want nay there is break, then add the same property but with the value false. Thus, the HTML generated for the column (<td>) will come with the property style="white-space:nowrap;".

Observing: From the image of your test there will never be a break because you have included a single word with hundreds of characters ("AAAAAAAAA...."). Try testing with long text, but with words of varying sizes and consistent with words that exist.

Browser other questions tagged

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