I have done my research but can't find an efficient way to do the following in VB:
- Each button should fire the same event.
- The button event saves every repeater item and so each event is not unique.
I am aware I can use the ItemCommand option but have not been able to get it working as desired.
ASP.NET
Inside Repeater Item
<asp:Button ID="btnSave" RunAt="Server"/>
VB.NET
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
sqlConn.Open()
For Each Item As RepeaterItem In rpt.Items
...
Next
sqlConn.Close()
End Sub
Edit:
After some research here on SO, I found that others events than
ItemCommand
are not caught byAsp:Repeater
, as FlySwat said on his answer. So you'll need to write yourVB.NET
code like this:First, declare the
ItemCommand
event on your page with something like this:Then, on
Asp:Button
markup inside theAsp:Repeater
, you must set itsCommandName
property like this:Take a look here to learn more about the
UseSubmitBehavior
.Try it.