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

#1 ikhlas06  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 178
  • 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
	PlaceHolder1.Controls.Add(MyBtns)
	a = a + 1
Next




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


Is This A Good Question/Topic? 0
  • +

Page 1 of 1