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.

4

2 回答 2

0

尝试“点击”事件,即

lb.Click += new EventHandler(lb_Click)
于 2012-07-24T10:51:09.483 回答
0

对于网格视图附加一个ItemDataBound事件,并在 itemDataBound 事件中获取链接按钮并使用每个链接按钮附加事件。

于 2012-07-24T11:31:29.543 回答