日期:2014-05-20  浏览次数:20372 次

datagrid中使用代码添加FooterTemplate出错,谢谢帮助
想在datagrid中使用代码添加FooterTemplate,无异常,但看不到效果.
Private   Sub   grdEntries_ItemCreated(ByVal   sender   As   Object,   ByVal   e   As   System.Web.UI.WebControls.DataGridItemEventArgs)   Handles   grdEntries.ItemCreated

If   (e.Item.ItemType   =   ListItemType.Footer)   Then

Dim   FrameText   As   New   StringBuilder
FrameText.Append( " <a   href= " " ")
FrameText.Append( "http://www.baidu.com ")
FrameText.Append( " " "   target=new> ")
FrameText.Append( " <IMG   alt= ")
FrameText.Append( " " "   mysite.com " " ")
FrameText.Append( "   src= ")
FrameText.Append( " " "test.gif " " ")
FrameText.Append( "   border=0>   </A> ")

Dim   lblIFrame   As   Label   =   New   Label()
lblIFrame.Text   =   FrameText.ToString
e.Item.Cells(0).Controls.Add(lblIFrame)
End   If
End   Sub

------解决方案--------------------
FrameText.Append( " <a href= " " ")
FrameText.Append( "http://www.baidu.com ")
FrameText.Append( " " " target=new> ")
FrameText.Append( " <IMG alt= ")
FrameText.Append( " " " mysite.com " " ")
FrameText.Append( " src= ")
FrameText.Append( " " "test.gif " " ")
FrameText.Append( " border=0> </A> ")

-------------
错误如下:
1. "不能包含 ",把 "里的 "换成 '
2. /会转义,改成 @ "字符串 "