Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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>

  • *Experts*
Posted

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.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted

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?

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...