Conditional Statements for Repeaters?

B

Brad Baker

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
 
S

Steven Cheng[MSFT]

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top