J
Juan Romero
Hey guys,
I am working on a web custom control that basically draws a table (ASP
Table) with a few child controls in the cells.
I have a command button inside one of these cells. The problem I am running
into is that I cannot get the click event of this object handled. I have
tried wiring the event with "AddHandler" among other things and that seems
not to work neither.
At this point I am completely stuck and ran out of ideas. Does anyone know
how to accomplish this?
Here is the code:
.......
.......
Public WithEvents oSubmit As New WebControls.Button
.....
.......
Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
oTable.Rows.Clear()
......
.........
oRow = New WebControls.TableRow
'Setup submit button cell
oCell = New WebControls.TableCell
'Add button to cell
oCell.Controls.Add(oSubmit)
'Add cell to Row
oRow.Cells.Add(oCell)
'Add Row to table
oTable.Rows.Add(oRow)
oTable.RenderControl(output)
End Sub
=============================
As you can see up there, the button is added dynamically to the cell. When I
run the page, the button simply does not generate a click event. Here is the
code for the click event:
Private Sub oSubmit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles oSubmit.Click
........
..............
End Sub
This never fires. Does anyone know why???
Thanks!
I am working on a web custom control that basically draws a table (ASP
Table) with a few child controls in the cells.
I have a command button inside one of these cells. The problem I am running
into is that I cannot get the click event of this object handled. I have
tried wiring the event with "AddHandler" among other things and that seems
not to work neither.
At this point I am completely stuck and ran out of ideas. Does anyone know
how to accomplish this?
Here is the code:
.......
.......
Public WithEvents oSubmit As New WebControls.Button
.....
.......
Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
oTable.Rows.Clear()
......
.........
oRow = New WebControls.TableRow
'Setup submit button cell
oCell = New WebControls.TableCell
'Add button to cell
oCell.Controls.Add(oSubmit)
'Add cell to Row
oRow.Cells.Add(oCell)
'Add Row to table
oTable.Rows.Add(oRow)
oTable.RenderControl(output)
End Sub
=============================
As you can see up there, the button is added dynamically to the cell. When I
run the page, the button simply does not generate a click event. Here is the
code for the click event:
Private Sub oSubmit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles oSubmit.Click
........
..............
End Sub
This never fires. Does anyone know why???
Thanks!