I want to know how to put a line break in a cell of a grid view. Right now, I put
1
1
1
However, this renders as
1 1 1
How do I fix the line breaks so that each digit is displayed on its own row?
Add HtmlEncode="False"
to asp:BoundField
and in the text, should have < br/>
for line breaks as:
<asp:BoundField DataField="Address" HeaderText="Address" HtmlEncode="False" />
You'll need to use the <br/>
tag to put a line break in your html.
You can use String.Replace(new char[] { '\n' }, "<br>")
to get the values with line-breaks replaced with <br/>
in C#.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With