DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
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:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us