Hi All,
I am brand new (like 2 weeks) to ASP.NET and VB.
I have a series of linkbuttons that are generated dynamically inside a repeater.
I need the background color of the selected linkButton to change and remain a new color when clicked. I thought that the ItemCommand property of the repeater would do the trick, but it doesn't.
Here is the code for the repeater:
Here is the Code Behind:
I have been hunting, reading, and reworking for a couple of hours now and I am completely confused. Any help would be greatly appreciated. Thanks!
Mike
I am brand new (like 2 weeks) to ASP.NET and VB.
I have a series of linkbuttons that are generated dynamically inside a repeater.
I need the background color of the selected linkButton to change and remain a new color when clicked. I thought that the ItemCommand property of the repeater would do the trick, but it doesn't.
Here is the code for the repeater:
Code:
<asp:Repeater ID="rptModuleMenuList" runat="server" DataSourceID="srcModuleItemList" OnItemCommand="rptModuleMenuList_ItemCommand" OnItemDataBound="rptModuleMenuList_DataBound">
<HeaderTemplate>
<div class="moduleMenuClass">
</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton runat="server" ID="modMenuButton1" CommandName="loadSubMenu" CommandArgument='<%#Eval("menu_item_id") %>' CssClass="taskMan"><%#Eval("menu_item_name") %></asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
</div>
</FooterTemplate>
</asp:Repeater>
Code:
Protected Sub rptModuleMenuList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles rptModuleMenuList.ItemCommand
Dim myButton As LinkButton
myButton = Me.FindControl(e.Item.ClientID.ToString())
myButton.BackColor = Drawing.Color.DimGray
End Sub
I have been hunting, reading, and reworking for a couple of hours now and I am completely confused. Any help would be greatly appreciated. Thanks!
Mike
Comment