- Код: Выделить всё
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Ht As System.Web.UI.WebControls.Unit
Dim Pic As System.Web.UI.WebControls.Image
Dim Txt As System.Web.UI.WebControls.TextBox
Dim Lnk As System.Web.UI.WebControls.LinkButton
Dim Tbl As System.Web.UI.WebControls.Table
Dim X As Integer
For X = 1 To 32
Pic = New System.Web.UI.WebControls.Image
Pic.ID = "P" & X
Pic.ImageUrl = ("images\" & X & ".jpg")
Pic.Visible = True
Pic.Attributes("left") = 0
plc.Controls.Add(Pic)
Txt = New System.Web.UI.WebControls.TextBox
Txt.ID = "T" & X
Txt.Text = "1"
Txt.Width = Ht.Pixel(32)
Txt.Visible = True
Txt.Attributes("left") = 0
plc.Controls.Add(Txt)
Lnk = New System.Web.UI.WebControls.LinkButton
Lnk.ID = "L" & X
Lnk.Text = "Color 54.00 "
Lnk.Visible = True
Lnk.Attributes("left") = 0
AddHandler Lnk.Click, AddressOf Button2_Click
plc.Controls.Add(Lnk)
Tbl = New System.Web.UI.WebControls.Table
Dim r As New TableRow
Dim i As New TableCell
Dim t As New TableCell
Dim l As New TableCell
i.Controls.Add(Pic)
t.Controls.Add(Txt)
l.Controls.Add(Lnk)
r.Cells.Add(i)
r.Cells.Add(t)
r.Cells.Add(l)
Tbl.ID = "T" & X
Tbl.Rows.Add(r)
Tbl.BorderWidth = Ht.Pixel(2)
plc.Controls.Add(Tbl)
Next
End Sub
Public Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
' Implementation code omitted.
End Sub
В коде, я загружаю контролы, но никак не могу поймать событие для LinkButton. Кто знает подскажите пожалуста где ошибка. Все контролы создаются, а вот событие (event) не работает.