想在datagrid中使用代码添加FooterTemplate,无异常,但看不到效果.
Private Sub grdEntries_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdEntries.ItemCreatedIf (e.Item.ItemType = ListItemType.Footer) ThenDim 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
Private Sub grdEntries_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdEntries.ItemCreatedIf (e.Item.ItemType = ListItemType.Footer) ThenDim 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
解决方案 »
- 权限到按钮
- asp.net 后台获取控件ID问题
- 有没有IIS的安装文件啊,每次都用系统盘装,大家有没有好点的装IIS的方法啊?求助
- 如何通过程序把 系统 计算机器 给调出来。。。。。
- asp.net的代码移到另一台机器上怎么调试不了?
- ------------Render()方法什么时候执行?由谁执行?------------
- 疑问,在一个页面上,能不能同时用VB和C#编程,谢谢
- 这样的SQL语句怎么写?
- sqlcommand.parameters有没有必要加Contains...RemoveAt判断啊?
- 如何重用一个webform窗体?
- Web.config文件在.aspx.cs文件中的怎么读取?
- ASP.NET DropDownList控件问题
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. /会转义,改成 @"字符串"
这里的代码如果把这个生成的控件不放到datagrid,而放到普通的页面控件中,没有问题
如下,这样可以
Dim PlaceHolder1 As PlaceHolder = New PlaceHolder ()
PlaceHolder1.Controls.Add(lblIFrame )因为需要,所以不能先设计好,而是要求用代码生成