How to Display Line Breaks from MySql in a VB.net DataGrid
One of the issues we have encountered in displaying data from a MySql database in a VB.net DataGrid is that the line breaks are not being displayed. To fix this, you will need to switch off AutoGenerateColumns in your DataGrid, i.e.
<asp:datagrid id="dgItems" runat="server" AutoGenerateColumns="false">
Then, instead of using a standard BoundColumn, i.e.:
<asp:BoundColumn DataField="ItemDescription" HeaderText="Review Description"></asp:BoundColumn>
Change it to a TemplateColumn as follows:
<asp:TemplateColumn HeaderText="Review Details">
This should mean that where the line break character appears in your MySql database, it is replaced by the html linebreak character <br />.
Note, it might also be worth checking that your line break characters are being added in to your MySql database in the first place. Use MySql Query Browser to view your data. The below shows data containing four line break characters:
All Content ©2020 WebRef.eu