Sorted. I've added the following in Page_Load. So simple
For Each thingy As RepeaterItem In uxMaterialNeedsRepeater.Items
Dim uxRepeaterItemPanel As Panel = CType(thingy.FindControl("uxRepeaterItemPanel"), Panel)
uxRepeaterItemPanel.BackColor = Nothing
Next
I Have a repeater
<asp:Repeater runat="server" ID="uxMaterialNeedsRepeater">
<ItemTemplate>
<p>
<asp:Panel runat="server" ID="uxRepeaterItemPanel">
<asp:LinkButton runat="server" ID="uxMaterialNeedLinkButton" CssClass="Label" CommandName="Select" CommandArgument='<%#Eval("ID")%>'>Select</asp:LinkButton>
<%#ReturnListOfMaterials(Container.DataItem)%>
</asp:Panel>
</p>
</ItemTemplate>
</asp:Repeater>
and when a user clicks the LinkButton generating an ItemCommand I highlight the 'row' the user has selected
Protected Sub uxMaterialNeedsRepeater_ItemCommand(source As Object, e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles uxMaterialNeedsRepeater.ItemCommand
If e.CommandName = "Select" Then
' Highlight the selected row
Dim uxRepeaterItemPanel As Panel = CType(e.Item.FindControl("uxRepeaterItemPanel"), Panel)
uxRepeaterItemPanel.BackColor = Drawing.Color.LightGreen
End If
End Sub
but if they select another row then I have two rows highlighted (highlit?) and I want to un-highlight the original row. So my thinking is to auto un-highlight all rows first.
How do I do this?
I've tried a few things including setting it at the ItemCreated event but that doesn't work either.
Protected Sub uxMaterialNeedsRepeater_ItemCreated(sender As Object, e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles uxMaterialNeedsRepeater.ItemCreated
' Remove any highlighting from all rows
Dim uxRepeaterItemPanel As Panel = CType(e.Item.FindControl("uxRepeaterItemPanel"), Panel)
uxRepeaterItemPanel.BackColor = Nothing
End Sub