Asp.net| Chinese
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.
Source: Li Xiyuan BLOG