S
stb
I have an empty asp:table on a form.
Rows and cells in the rows are added programatically. At the end of each
row, there is a cell with a button inside it.
How do I catch the button's click event?
dim dr as sqlDataReader
Dim tempCell As TableCell
dr=........
While dr.Read
Dim tempRow As New TableRow
Dim i As Integer
For i = 0 To dr.FieldCount - 1
tempCell = New TableCell
tempCell.Text = CStr(dr.GetValue(i))
tempRow.Cells.Add(tempCell)
Next i
tempCell = New TableCell
btn = New Button
btn.CommandName = "Edit"
btn.CommandArgument = i
btn.Text = "Edit"
tempCell.Controls.add(btn)
tempRow.Cells.Add(tempCell)
Table1.Rows.Add(tempRow)
End While
Rows and cells in the rows are added programatically. At the end of each
row, there is a cell with a button inside it.
How do I catch the button's click event?
dim dr as sqlDataReader
Dim tempCell As TableCell
dr=........
While dr.Read
Dim tempRow As New TableRow
Dim i As Integer
For i = 0 To dr.FieldCount - 1
tempCell = New TableCell
tempCell.Text = CStr(dr.GetValue(i))
tempRow.Cells.Add(tempCell)
Next i
tempCell = New TableCell
btn = New Button
btn.CommandName = "Edit"
btn.CommandArgument = i
btn.Text = "Edit"
tempCell.Controls.add(btn)
tempRow.Cells.Add(tempCell)
Table1.Rows.Add(tempRow)
End While