如何通过一个class设定HyperLink的text
gqxm 2003-08-20 12:09:31 一个页面有一个panel包含中三个HyperLink,现在我想通过调用一个class1.vb中的一个过程设置HyperLink的text,
但通过下面的语句却不能设置,请问原因?
Protected WithEvents Panel1 As System.Web.UI.WebControls.Panel
Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink2 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink3 As System.Web.UI.WebControls.HyperLink
dim class11 as new class1()
page.load
class11.texttohy(panel1)
Public Class class1
Public Sub texttohy(ByRef panel1 As Panel)
i=1
do while i<4
dim HyperLink0 as new HyperLink
HyperLink0.ID = "HyperLink" & i.ToString()
HyperLink0.Text = i.ToString()
i=i+1
loop
End Sub
end class
另外下面语句为什么出错:
Public Class class1
Public sub texttohy(ByRef panel1 As Panel1,ByRef HyperLink1 As HyperLink)
panel1.FindControl("HyperLink1")---出错
end sub
end class