dekode Posted December 23, 2003 Posted December 23, 2003 Okay I'm trying to change the visible attribute of the panels inside this repeater - how do I reference this in my code behind? Here's the repeater: <asp:Repeater ID="rpMenuItems" Runat="server"> <ItemTemplate> <tr> <td width="109" bgcolor="#6f0039"> <a href="<%# Databinder.Eval(Container.DataItem, "Link") %>" class="link-leftmenu"><%# Databinder.Eval(Container.DataItem, "MenuItem") %></a> <asp:Panel ID="adminlink"> <a href="#" class="link-leftmenu" onclick="OpenAdmin('MenuEdit.aspx')">[+]</a> </asp:Panel> </td> </tr> </ItemTemplate> </asp:Repeater> Quote
*Experts* Bucky Posted December 23, 2003 *Experts* Posted December 23, 2003 Inside the repeater control, create a LinkButton control that has the CommandArgument and CommandName attributes set depending on the panel you want to show and hide. Then, when this LinkButton is clicked, the ItemCommand event of the Repeater control is fired. It's in this event handler that you can change the visibility of the panel. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
dekode Posted December 23, 2003 Author Posted December 23, 2003 I just want to know how to hide all the panels at once. I want to shut the panels off before the user logs into the site, then turn them all back on when their login is successful. How do I reference all the panels' visible attributes? Quote
kahlua001 Posted December 23, 2003 Posted December 23, 2003 Reference each Items's panel during the ItemCreated or ItemDataBound event and set the Visible depending on login status. Quote
dekode Posted December 23, 2003 Author Posted December 23, 2003 Can someone post some syntax??? I understand the concepts, I just don't know 'how to do it'... Quote
kahlua001 Posted December 23, 2003 Posted December 23, 2003 Dim blnLoggedIn As Boolean = False Private Sub Repeater1_ItemCommand(ByVal s as Object, ByVal e As RepeaterItemEventArgs) Handles Repeater1.ItemCreated Dim Panel As Panel If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then Panel = e.Item.FindControl("pnlMyPanel") If blnLoggedIn Then Panel.Visible = True Else Panel.Visible = False End If End Sub Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.