G
gce
Allthough button2 created with the designer works 100%. The button I created
(inside the table) with dim button1 as new button doesn't give me a click
event. Please help.
Public Class WebForm8
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents Table1 As System.Web.UI.WebControls.Table
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Button2 As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim rij1 As New TableRow
Dim cel1 As New TableCell
Dim cel2 As New TableCell
Dim header As New TableHeaderCell
header.RowSpan = 1
header.ColumnSpan = 2
header.Text = "test"
header.Font.Bold = True
header.HorizontalAlign = HorizontalAlign.Center
header.VerticalAlign = VerticalAlign.Middle
Dim headerrow As New TableRow
headerrow.Cells.Add(header)
Table1.Rows.Add(headerrow)
Dim button1 As New Button
button1.Text = "knop"
cel1.Controls.Add(button1)
cel2.Text = "cel2"
rij1.Cells.Add(cel1)
rij1.Cells.Add(cel2)
Table1.Rows.Add(rij1)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim popupScript As String = "<script language='javascript'>" & _
"window.open('http://www.nu.nl', 'NU', " & _
"'width=200, height=200, menubar=yes, resizable=no')" &
_
"</script>"
Page.RegisterStartupScript("PopupScript", popupScript)
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim popupScript As String = "<script language='javascript'>" & _
"window.open('http://www.nu.nl', 'NU', " & _
"'width=200, height=200, menubar=yes,
resizable=no')" & _
"</script>"
Page.RegisterStartupScript("PopupScript", popupScript)
End Sub
End Class
(inside the table) with dim button1 as new button doesn't give me a click
event. Please help.
Public Class WebForm8
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents Table1 As System.Web.UI.WebControls.Table
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Button2 As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim rij1 As New TableRow
Dim cel1 As New TableCell
Dim cel2 As New TableCell
Dim header As New TableHeaderCell
header.RowSpan = 1
header.ColumnSpan = 2
header.Text = "test"
header.Font.Bold = True
header.HorizontalAlign = HorizontalAlign.Center
header.VerticalAlign = VerticalAlign.Middle
Dim headerrow As New TableRow
headerrow.Cells.Add(header)
Table1.Rows.Add(headerrow)
Dim button1 As New Button
button1.Text = "knop"
cel1.Controls.Add(button1)
cel2.Text = "cel2"
rij1.Cells.Add(cel1)
rij1.Cells.Add(cel2)
Table1.Rows.Add(rij1)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim popupScript As String = "<script language='javascript'>" & _
"window.open('http://www.nu.nl', 'NU', " & _
"'width=200, height=200, menubar=yes, resizable=no')" &
_
"</script>"
Page.RegisterStartupScript("PopupScript", popupScript)
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim popupScript As String = "<script language='javascript'>" & _
"window.open('http://www.nu.nl', 'NU', " & _
"'width=200, height=200, menubar=yes,
resizable=no')" & _
"</script>"
Page.RegisterStartupScript("PopupScript", popupScript)
End Sub
End Class