0

I need some help to bind my dynamically created linkbutton to an event when clicked (inside a gridview)...

I saw many questions about that but always says that can be used the .OnClick += New EventHandler(event) and actually I've not the ".OnClick" property to use, I just have the OnClientClick property that can't be used by the EventHandler, here is the custom answers and what I need:

Custom answers on web:

 Dim lb As New LinkButton
 lb.Text = "Add"
 lb.OnClick += New EventHandler(lb_Click)
 grid1.FooterRow.Cells(0).Controls.Add(lb)

What I need is something like that but with a correct property that can fire an event.

thevan
  • 10,052
  • 53
  • 137
  • 202
B1GB0Y
  • 43
  • 3
  • 12

2 Answers2

0

Try the "Click" event instead, i.e.

lb.Click += new EventHandler(lb_Click)
Andrew Stephens
  • 9,413
  • 6
  • 76
  • 152
0

For grid view attach a ItemDataBound event and in itemDataBound event get the link button and attach event with each link button.

Zaksh
  • 953
  • 2
  • 12
  • 29