Repeater Separator question

Discussion in 'ASP .Net Web Controls' started by Nick Foster, Jul 26, 2007.

  1. Nick Foster

    Nick Foster Guest

    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
     
    Nick Foster, Jul 26, 2007
    #1
    1. Advertising

  2. Nick Foster

    marss Guest

    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
     
    marss, Jul 27, 2007
    #2
    1. Advertising

  3. Nick Foster

    Nick Foster Guest

    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
    >
    >
     
    Nick Foster, Jul 27, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    903
  2. Replies:
    0
    Views:
    2,934
  3. Replies:
    1
    Views:
    7,069
    Karl Seguin
    Aug 10, 2005
  4. Thomas Liesner
    Replies:
    13
    Views:
    467
    Fredrik Lundh
    Dec 10, 2005
  5. uncensored
    Replies:
    0
    Views:
    847
    uncensored
    Oct 25, 2006
Loading...

Share This Page