Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
createButton(lblCat.Text)
End Sub
Private Sub createButton(ByVal cat As String)
Dim db As New Bcwebcheck.DBProxy_Bcweb_new
Dim dr As SqlClient.SqlDataReader = Nothing
Dim i As Integer
db.AddParameter("@Cat", lblCat.Text.Trim)
db.ExecCommand("sp_bcwebnew_Select_List_Weight", dr)
While dr.Read
Dim btn As Button = New Button()
btn.ID = ("btnW" & dr.Item("ItemWeight").ToString())
btn.Text = (dr.Item("ItemWeight").ToString())
btn.Attributes.Add("runat", "server")
btn.Attributes.Add("class", "button")
AddHandler btn.Click, AddressOf btnW_Click ' Add button click handler
Panel1.Controls.Add(btn)
i += 1
End While
db.CloseConnection()
End Sub
Protected Sub btnCat1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCat1.Click
lblCat.Text = "G1"
'createButton(lblCat.Text)
loadProduct(lblCat.Text, lblWeight.Text)
End Sub
Protected Sub btnCat2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCat2.Click
...
End Sub