0 Replies - 1429 Views - Last Post: 29 September 2017 - 10:49 AM Rate Topic: -----

#1 ikhlas06   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 327
  • Joined: 20-May 16

AddHandler not working

Posted 29 September 2017 - 10:49 AM

I am using VB asp.net

I am using following link: https://www.aspsnipp...in-ASP.Net.aspx

I have a loop and I am creating buttons depending on how many items are in dropdown list. Each button has a click addhandler. so when user click on button than it should run myFun_click function.

Issue: issue is that label does not has the value "testtt" so this means myFun_Click is not beeing run. I am not sure what could be the issue here

For Each i In MyDropDown.Items
	Dim MyBtns As New LinkButton()
	MyBtns.ID = "btn" & a.ToString
	MyBtns.Text = i.text
	AddHandler MyBtns.Click, AddressOf myFun_Click
	a = a + 1

     Protected Sub myFun_Click(ByVal sender As Object, ByVal e As EventArgs)
        Label1.Text = "testtt"
    End Sub

Is This A Good Question/Topic? 0
  • +

Page 1 of 1