当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > Asp.Net文本换行

ASP.NET
Web服务器控件:LinkButton控件
Web服务器控件:ListBox控件
Web服务器控件:ListItem控件
Web服务器控件:Literal控件
Web服务器控件:Panel控件
Web服务器控件:PlaceHolder控件
Web服务器控件:RadioButton控件
Web服务器控件:RadioButtonList控件
Web服务器控件:BulletedList控件
Web服务器控件:Style控件
Web服务器控件:Table控件
Web服务器控件:TableCell控件
Web服务器控件:TableRow控件
Web服务器控件:TextBox控件
Web服务器控件:XML控件
Validation服务器控件:CompareValidator控件
Validation服务器控件:CustomValidator控件
Validation服务器控件:RangeValidator控件
Validation服务器控件:RegularExpressionValidator控件
Validation服务器控件:RequiredFieldValidator控件

ASP.NET 中的 Asp.Net文本换行


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 138 ::
收藏到网摘: n/a

private String HtmlCode(string TString)
{
if (TString != null)
{
TString = TString.Replace("\r", "<br>");
TString = TString.Replace(" ", " ");
return TString;
}
else
{
return TString="无内容";
}
}
使用范例:
this.ContentTxt.Text = HtmlCode(NewsTab.Rows[0]["ContentTxt"].ToString());
注:.ContentTxt为Label标签控件;NewsTab.Rows[0]["ContentTxt"].ToString()为读取数据库表中的记录集。