我有以下GetText()
功能,這關係到我的問題,這是被稱爲在以下地方:奇怪的標籤
myGridView.DataSource = stuff.Select(s => new
{
//...some stuff here
f.Text = GetText();
}
myGridView.DataBind();
的getText如下所示:
private void string GetText()
{
StringBuilder sb = new StringBuilder();
sb.Append("<abbr title=\"Testing\">");
sp.Append("This is the Text that I want to display");
sb.Append("<\abbr>");
}
所以基本上,我想要做的就是能夠在我的網頁上具有以下HTML:
<abbr title="Testing">This is the text that I want to display</abbr>
然而,有一個神祕的標籤顯示出來。在谷歌瀏覽器,我看了個控制檯,我看到它是這樣的:
<abbr title="Testing">This is the text that I want to display<bbr></abbr>
還有就是當我行sb.Append("<\abbr>");
當我刪除了這一行這是固定的添加會產生多餘的標籤,但我想找到更好的解決方案,因爲這會使代碼看起來很尷尬。
我也試着做下面的代替多行sb.Appends()
,但額外的文本仍然顯示。
sb.Append(string.Format("<abbr title=\"testing\">{0}<\abbr>",Text));
注意:假設文本是等於說我要顯示的文本字符串。