Conditional Statements for Repeaters?

Discussion in 'ASP .Net' started by Brad Baker, Apr 18, 2006.

  1. Brad Baker

    Brad Baker Guest

    I have several asp.net repeaters which I need to display based on the value
    of a dropdown. I.E. If item1 in a dropdown is selected then repeater1 needs
    to be displayed, if item item2 is selected then repeater2 needs to be
    displayed.



    I have no problem writing and displaying a single repeater and I know how to
    test the value of a dropdown but I can't seem to figure out how to combine
    the two. (In other words test for the value of form variable, then display
    the corresponding repeater in the body of a page.)



    Is there a way to do what I want in C# or am I approaching this problem from
    the wrong angle?



    Thanks,

    Brad
    Brad Baker, Apr 18, 2006
    #1
    1. Advertising

  2. repeater1.visible = false

    --
    ( OHM ) - One Handed Man
    AKA Terry Burns - http://TrainingOn.net
    "Brad Baker" <> wrote in message
    news:O%...
    >I have several asp.net repeaters which I need to display based on the value
    >of a dropdown. I.E. If item1 in a dropdown is selected then repeater1 needs
    >to be displayed, if item item2 is selected then repeater2 needs to be
    >displayed.
    >
    >
    >
    > I have no problem writing and displaying a single repeater and I know how
    > to test the value of a dropdown but I can't seem to figure out how to
    > combine the two. (In other words test for the value of form variable,
    > then display the corresponding repeater in the body of a page.)
    >
    >
    >
    > Is there a way to do what I want in C# or am I approaching this problem
    > from the wrong angle?
    >
    >
    >
    > Thanks,
    >
    > Brad
    >
    >
    OHM \( One Handed Man \), Apr 18, 2006
    #2
    1. Advertising

  3. Hi Brad,

    I think you can consider Terry's suggestion that add those repeater
    statically on the page but make them invisible. Then, in the DropDownlist's
    SelectedIndexChanged event, dynamically use the Repeater.visible property
    to make certain repeater displayed according to the new selected item's
    value.

    Regards,

    Steven Cheng
    Microsoft Online Community Support


    ==================================================

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Apr 18, 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. Neil Zanella
    Replies:
    8
    Views:
    1,170
    mfmehdi
    Oct 20, 2006
  2. Harry George
    Replies:
    6
    Views:
    363
    Bart Nessux
    Feb 23, 2004
  3. Vince
    Replies:
    12
    Views:
    739
    Martin Gregorie
    Jan 21, 2008
  4. Conditional code in Repeaters

    , Jun 20, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    114
  5. Evan M.

    Conditional code in Repeaters

    Evan M., Jun 17, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    102
    Evan M.
    Jun 17, 2005
Loading...

Share This Page