Help! I swear I've tried everything and getting nothing. I'm trying to add a button at run time but when the button is clicked all I get is a postback event. The event that I want to fire, never does. Thanks in advance....here's my code.
Currently this is in the Private Sub InitializeComponent
Protected WithEvents btnUpdateAdj As New System.Web.UI.WebControls.Button
this is all being called in a sub If Not Page.IsPostBack
'Private WithEvents btnUpdateAdj As New Button
'btnUpdateAdj = New Button
btnUpdateAdj.Text = "Update Adjudication"
'btnUpdateAdj.ID = "btnUpdateAdj"
'btnUpdateAdj.Attributes.Add("onClick", "update")
'btnUpdateAdj.CommandArgument = "test"
'btnUpdateAdj.CommandName = "add"
Dim tRowHeader As New TableRow
Dim tCell As New TableCell
tRowHeader = GetTableHeaderRow(tableResults)
tCell.BackColor = System.Drawing.Color.White
tCell.HorizontalAlign = HorizontalAlign.Center
tCell.ColumnSpan = 2
tRowHeader.Cells.Add(tCell)
tcell.Controls.Add(btnUpdateAdj)
AddHandler btnUpdateAdj.Click, AddressOf update
and here's the event
Public Sub update(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Write("test")
End Sub
Currently this is in the Private Sub InitializeComponent
Protected WithEvents btnUpdateAdj As New System.Web.UI.WebControls.Button
this is all being called in a sub If Not Page.IsPostBack
'Private WithEvents btnUpdateAdj As New Button
'btnUpdateAdj = New Button
btnUpdateAdj.Text = "Update Adjudication"
'btnUpdateAdj.ID = "btnUpdateAdj"
'btnUpdateAdj.Attributes.Add("onClick", "update")
'btnUpdateAdj.CommandArgument = "test"
'btnUpdateAdj.CommandName = "add"
Dim tRowHeader As New TableRow
Dim tCell As New TableCell
tRowHeader = GetTableHeaderRow(tableResults)
tCell.BackColor = System.Drawing.Color.White
tCell.HorizontalAlign = HorizontalAlign.Center
tCell.ColumnSpan = 2
tRowHeader.Cells.Add(tCell)
tcell.Controls.Add(btnUpdateAdj)
AddHandler btnUpdateAdj.Click, AddressOf update
and here's the event
Public Sub update(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Write("test")
End Sub