|
|
|
start date: Thu, 26 Jul 2007 08:20:02 -0700,
posted on: microsoft.public.dotnet.framework.aspnet.webcontrols
back
| Thread Index |
|
1
Nick Foster
|
|
2
marss
|
|
3
Nick Foster
|
Repeater Separator question
I have a repeater I have bound to a custom collection of TicketLogEntries.
If a TicketLogEntry is marked as private and the user is not an
administrator, then the Item is hidden (code below).
The question is: if I set an item's or alteratingitem's Visible property to
False, can I also hide the accompanying Separator? It's a bit of a giveaway
that records are invisible if the separator is still showing :(
Private Sub rptrLog_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptrLog.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
Dim bPrivate As Boolean = CType(e.Item.DataItem,
TicketLogEntry).IsPrivate
If bPrivate AndAlso HttpContext.Current.User.IsInRole("Administrator")
= False Then
e.Item.Visible = False
End If
End If
End Sub
Thanks,
Nick
Date:Thu, 26 Jul 2007 08:20:02 -0700
Author:
|
Re: Repeater Separator question
Nick Foster :
> The question is: if I set an item's or alteratingitem's Visible property to
> False, can I also hide the accompanying Separator? It's a bit of a giveaway
> that records are invisible if the separator is still showing :(
Private hideSeparator As Boolean = False
Private Sub rptrLog_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
rptrLog.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
Dim bPrivate As Boolean = CType(e.Item.DataItem,
TicketLogEntry).IsPrivate
If bPrivate AndAlso
HttpContext.Current.User.IsInRole("Administrator") = False Then
e.Item.Visible = False
End If
hideSeparator = e.Item.Visible
End If
If e.Item.ItemType = ListItemType.Separator And hideSeparator Then
e.Item.Visible = False
End If
End Sub
Regards,
Mykola
http://marss.co.ua
Date:Thu, 26 Jul 2007 22:05:24 -0700
Author:
|
Re: Repeater Separator question
Mykola,
Thanks for pointing me in the right direction. One small change and it's
working great!
your line:
> hideSeparator = e.Item.Visible
hid the separators for the visible items :) Using:
hideSeparator = (e.Item.Visible = False)
and everything is great.
Thanks again.
"marss" wrote:
>
> Nick Foster :
>
> > The question is: if I set an item's or alteratingitem's Visible property to
> > False, can I also hide the accompanying Separator? It's a bit of a giveaway
> > that records are invisible if the separator is still showing :(
>
>
> Private hideSeparator As Boolean = False
>
> Private Sub rptrLog_ItemDataBound(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
> rptrLog.ItemDataBound
> If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
> ListItemType.AlternatingItem Then
> Dim bPrivate As Boolean = CType(e.Item.DataItem,
> TicketLogEntry).IsPrivate
> If bPrivate AndAlso
> HttpContext.Current.User.IsInRole("Administrator") = False Then
> e.Item.Visible = False
> End If
> hideSeparator = e.Item.Visible
> End If
> If e.Item.ItemType = ListItemType.Separator And hideSeparator Then
> e.Item.Visible = False
> End If
> End Sub
>
> Regards,
> Mykola
> http://marss.co.ua
>
>
Date:Thu, 26 Jul 2007 23:56:00 -0700
Author:
|
|
|