How to allow row breaking in gridview?

2

I ran a test on my GridView writing the title of a book with many characters, which happened as follows: It expanded my grid beyond the page size, causing a layout break. My GridView is with Width="100%" . I have tried to put in the column ItemStyle-Wrap="False" but it did not work, how to solve?

    
asked by anonymous 17.05.2015 / 20:45

1 answer

1

The workaround is to set the following property in the column that you want the line break to be:

 ItemStyle-Wrap="True"

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

Note : Your test image will never be broken since you included a single word with hundreds of characters ("AAAAAAAAA ....."). Try to test with long text, but with words of varying sizes and consistent with words that exist.

    
18.05.2015 / 05:54