Hey guys,
I got a headache today because of this (little?) problem. I hope you can help me find the solution.
I have a repeater which contains a button and an image in each row/item.
I already set the button's commandargument with the ID (key) of the data.
What I want is, when the button is clicked (fire the Repeater.ItemCommand event), I want to mark the ItemIndex being fired using the conditions:
button.visible=false
and
image.visible=true
My problem is, even after I click other datarow's button, the mark of the previous datarow doesn't change. The button is still invisible and the image is still there.
Here's my code inside the ItemCommand event. What exactly did I miss here?
Protected Sub RepDocument_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles RepDocument.ItemCommand
If e.CommandArgument <> "" And e.CommandName = "edit" Then
For Each RI As RepeaterItem In RepDocument.Items
Dim b As Button = TryCast(e.Item.FindControl("B_edit"), Button) 'the button that fired this event
Dim img As Image = TryCast(e.Item.FindControl("Image1"), Image) 'the image to be the mark
If b.CommandArgument = e.CommandArgument Then
b.Visible = False
img.Visible = True
Else
b.Visible = True
img.Visible = False
End If
Next
'bla bla bla
End If
End Sub