Adding different buttons and dropdownlist in rows

Cronosis

Newcomer
Joined
Jun 13, 2004
Messages
1
Hi,

I have difficulties in continuing my program while encounter this problem. wish i could get some expert advise here. :)

i wanted to add an button and a dropdownlist in the row of a table. Each of this dropdownlist shows different values. And the number of rows generated depend on the number of record stored in my database. That's mean i would have to add in the button and dropdownlist programmatically. But problems comes in when i want to tie a function to the buttons.

I could not find any way to execute the function when i press the button.

below are some of my source code:
While oDr.Read

If currentgroup <> oDr.Item(0) Then
tc(totalcell) = New TableCell()
tr(totalrow) = New TableRow()
tc(totalcell).BackColor = Drawing.ColorTranslator.FromHtml("#DFE6EE")
tc(totalcell).ColumnSpan = 2
tc(totalcell).HorizontalAlign = HorizontalAlign.Left
tc(totalcell).CssClass = "record2"
tc(totalcell).Text = "Group: " + oDr.Item("zone_group_id").ToString
tr(totalrow).Cells.Add(tc(totalcell))
grouptbl.Rows.Add(tr(totalrow))
currentgroup = oDr.Item(0)
totalrow -= 1
totalcell -= 1
End If
butt(total) = New Button()
drop(total) = New DropDownList()

drop(total).CssClass = "box"
drop(total).DataTextField = "grouping"
drop(total).DataValueField = "zone_grouping_id"
drop(total).DataSource = temp
drop(total).DataBind()

butt(total).Text = "Move"
butt(total).CausesValidation = False

butt(total).CssClass = "button"
'butt(total). = "Move_it"

tc(totalcell) = New TableCell()
tr(totalrow) = New TableRow()
tc(totalcell).BackColor = System.Drawing.ColorTranslator.FromHtml("#FBFCFD")

tc(totalcell).HorizontalAlign = HorizontalAlign.Left
tc(totalcell).CssClass = "record4"
tc(totalcell).Text = "Zone: " + oDr.Item("zone_area").ToString
tr(totalrow).Cells.Add(tc(totalcell))
totalcell -= 1
tc(totalcell) = New TableCell()

tc(totalcell).BackColor = System.Drawing.ColorTranslator.FromHtml("#FBFCFD")
tc(totalcell).HorizontalAlign = HorizontalAlign.Left
tc(totalcell).CssClass = "record4"
tc(totalcell).Controls.Add(drop(total))
'Dim c1 As UserControl = LoadControl("moving.ascx")
'tc(totalcell).Controls.Add(c1)
tr(totalrow).Cells.Add(tc(totalcell))
totalcell -= 1

grouptbl.Rows.Add(tr(totalrow))
total -= 1
totalrow -= 1

End While
 
Back
Top