我在页面动态添加了一些LinkButton,并绑定了事件,但事件就是触发不了,请高手帮忙解决,代码如下:
Private Sub PageButtonClick(ByVal sender As Object, ByVal e As System.EventArgs)
Dim a As LinkButton
a = sender
iCurrPage = a.Text
PAddBtn(10)
a.CssClass = "link curr"
End Sub Private Sub PAddBtn(ByVal iCount As Integer)
Dim i As Integer
For i = 1 To iCount
Dim o As New LinkButton
o.Text = i.ToString
If o.Text = iCurrPage.ToString Then
o.CssClass = "link curr"
Else
o.CssClass = "link normal"
End If
AddHandler o.Click, AddressOf PageButtonClick
Me.Panel1.Controls.Add(o)
Next End Sub
Private Sub PageButtonClick(ByVal sender As Object, ByVal e As System.EventArgs)
Dim a As LinkButton
a = sender
iCurrPage = a.Text
PAddBtn(10)
a.CssClass = "link curr"
End Sub Private Sub PAddBtn(ByVal iCount As Integer)
Dim i As Integer
For i = 1 To iCount
Dim o As New LinkButton
o.Text = i.ToString
If o.Text = iCurrPage.ToString Then
o.CssClass = "link curr"
Else
o.CssClass = "link normal"
End If
AddHandler o.Click, AddressOf PageButtonClick
Me.Panel1.Controls.Add(o)
Next End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货