Data Repeater :: Can you?

Discussion in 'ASP .Net' started by mikeyatsony, Jun 13, 2006.

  1. mikeyatsony

    mikeyatsony Guest

    Hi all...
    I've been training a little on the whole ASP.NET and would like to know
    how someone would use the data repeater like this:

    For example, I have some data coming from a table and let's say for
    some of the rows, I would like to show a website for the company if
    they had that level of membership but for others, I would like to HIDE
    the website for the company. It could be as easy as a BIT field in the
    table like SHOWURL, if checked, it shows, if not, the URL should not
    show.

    Is there a way to do this? Do you use another control?

    Thoughts?
    mikeyatsony, Jun 13, 2006
    #1
    1. Advertising

  2. You can use a DataBinding expression that calls a custom function.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    Professional Chicken Salad Alchemist

    A lifetime is made up of
    Lots of short moments.

    "mikeyatsony" <> wrote in message
    news:...
    > Hi all...
    > I've been training a little on the whole ASP.NET and would like to know
    > how someone would use the data repeater like this:
    >
    > For example, I have some data coming from a table and let's say for
    > some of the rows, I would like to show a website for the company if
    > they had that level of membership but for others, I would like to HIDE
    > the website for the company. It could be as easy as a BIT field in the
    > table like SHOWURL, if checked, it shows, if not, the URL should not
    > show.
    >
    > Is there a way to do this? Do you use another control?
    >
    > Thoughts?
    >
    Kevin Spencer, Jun 13, 2006
    #2
    1. Advertising

  3. mikeyatsony

    Guest

    you could also hide the control in markup ... eg.
    <asp:Label runat="server" id="lbl" visible="<%# Eval("AllowedToView")
    %>" />

    or control it via an ItemDataBound event handler

    protected void rpt_ItemDataBound(object sender, RepeaterItemEventArgs
    e)
    {
    if (e.Item.ItemType == ListItemType.Item ||
    e.Item.ItemType == ListItemType.AlternatingItem)
    {
    WhateverYouBound ob = e.Item.DataItem as WhateverYouBound;
    Label lbl = (Label)e.Item.FindControl("lbl");
    lbl.Visible = ob.AllowedToView
    }
    }

    sound good?

    Kevin Spencer wrote:
    > You can use a DataBinding expression that calls a custom function.
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > Professional Chicken Salad Alchemist
    >
    > A lifetime is made up of
    > Lots of short moments.
    >
    > "mikeyatsony" <> wrote in message
    > news:...
    > > Hi all...
    > > I've been training a little on the whole ASP.NET and would like to know
    > > how someone would use the data repeater like this:
    > >
    > > For example, I have some data coming from a table and let's say for
    > > some of the rows, I would like to show a website for the company if
    > > they had that level of membership but for others, I would like to HIDE
    > > the website for the company. It could be as easy as a BIT field in the
    > > table like SHOWURL, if checked, it shows, if not, the URL should not
    > > show.
    > >
    > > Is there a way to do this? Do you use another control?
    > >
    > > Thoughts?
    > >
    , Jun 14, 2006
    #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. Doris Cox
    Replies:
    0
    Views:
    543
    Doris Cox
    Dec 2, 2003
  2. Dennis
    Replies:
    0
    Views:
    690
    Dennis
    Dec 2, 2003
  3. Richard Dixson
    Replies:
    1
    Views:
    507
    Joe Fallon
    May 18, 2004
  4. Dennis
    Replies:
    0
    Views:
    446
    Dennis
    Dec 2, 2003
  5. pek
    Replies:
    0
    Views:
    1,140
Loading...

Share This Page