我的页面上有一个占位符,似乎无法让它做一个简单的超链接。当然我错过了什么?这是代码:
word.aspx
<asp:PlaceHolder ID="PlaceHolder1" runat="server">
<asp:HyperLink ID="Link1" runat="server" />
</asp:PlaceHolder>
或
<asp:PlaceHolder ID="PlaceHolder1" runat="server">
</asp:PlaceHolder>
和背后的代码:
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Partial Public Class Word
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs)
Dim hyperlink1 As New HyperLink()
hyperlink1.Text = "Devmanuals"
hyperlink1.NavigateUrl = "http://www.devmanuals.com/"
PlaceHolder1.Controls.AddAt(0, hyperlink1)
End Sub
End Class
或
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Partial Public Class Word
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs)
Dim hyperlink1 As New HyperLink()
hyperlink1.Text = "Devmanuals"
hyperlink1.NavigateUrl = "http://www.devmanuals.com/"
PlaceHolder1.Controls.Add(hyperlink1)
End Sub
End Class
我没办法上班。