Just get started to learn asp.net friends, will encounter a large number of lines with the text of the content display, will not automatically wrap the problem. I now put the solution to this problem really effective way to tell you to learn together:
In the vb.net:
1 function Htmlcode () function Htmlcode (ByVal fstring)
2 If fstring <> "" Then
3 fstring = Replace (fstring, CHR (13), "")
4 fstring = Replace (fstring, Chr (a) & Chr (a), "</P><P>")
5 fstring = Replace (fstring, Chr (), "<BR>")
6 Htmlcode = fstring
7 End If
8 End Function
9
Use Example:
Contenttxt.text = Htmlcode (Rs.item ("Newscontent"))
Note:. Contenttxt is a label label control; Rs.item ("newscontent") reads a recordset from a database table.
The above code is available in my. NET blog system to find the detailed code.
In C #:
private string Htmlcode (String tstring)
{
if (tstring!= null)
{
tstring = Tstring.replace ("\ R", "<br>");
tstring = Tstring.replace ("", "");
return tstring;
}
Else
{
Return tstring= "no content";
}
}
Use Example:
This. Contenttxt.text = Htmlcode (newstab.rows[0]["Contenttxt"). ToString ());
Note:. Contenttxt is a label label control; newstab.rows[0]["Contenttxt". ToString () is reading a recordset in a database table.
The above code is available in my. NET News system to find the detailed code.
Http://lixyvip.cnblogs.com/archive/2006/03/30/362593.html
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service