Call Repeater ItemCommand event manually from outside the repeater

Following is the code to call repeater item command event manually

Private Sub btnTest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTest.Click

For i = 0 To rptPlayers.Items.Count – 1

Dim tItem As RepeaterItem = rptPlayers.Items(i)

Dim tButton As ImageButton = ptPlayers.Items(i).FindControl(“imgAdd”)

Dim tEvents As New System.Web.UI.WebControls.CommandEventArgs(tButton.CommandName, tButton.CommandArgument)

Dim rpt As New RepeaterCommandEventArgs(tItem, tButton, tEvents)

rptPlayers_ItemCommand(tButton, rpt)


End Sub

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s