Wrap long text in GridView and report viewer in ASP.Net

Last Reply 10 months ago By kalpesh

Posted 10 months ago

What i want, if the text is too long to fit as per the defined width, the text should be wrapped in next row. I don’t want to expand the column width to accommodate this text in one row. In other words, I want to wrap the text in next row if the text inside this columns exceeded the width of the column defined in gridview and reportviewer

Posted 10 months ago
Hi @DiemHuong,
Please try the following

Wrap long text in GridView Column in ASP.Net

It might help you.

Cheers Andrea.

Posted 10 months ago

How you are setting the grid colums Width. Just assign the ItemStyle-Width like ItemStyle-Width="100px" to set the BoundField or TemplateField.


<asp:GridView ID="GVDetails" runat="server"   AutoGenerateColumns="false">
        <asp:BoundField DataField="Description" ItemStyle-Width="100px" HeaderText="Description" />
        <asp:TemplateField ItemStyle-Width="100px"  HeaderText="Description">
                <asp:Label ID="lblDescription" runat="server" Text='<%#Eval("Description") %>'>                        


For ReportViewer go to your RDLC report and Right Click on Field name => Select Text Box Properties from Options => Checked Allow height to increase.