Solved

What is the best way to dynamically hide / show a panel?

Posted on 2011-09-28
3
533 Views
Last Modified: 2012-05-12
I'm trying to dynamically show / hide a panel (and subsequently it's contents), based the value chosen in a drop down list. I think i can do this in jQuery though I'm not sure if  that is the most efficient / best way, or if there is a simpler / easier / faster / more resourceful way to accomplish this. Any help or links to help would be appreciated.
0
Comment
Question by:mikesExpertExchange
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Assisted Solution

by:jagrut_patel
jagrut_patel earned 200 total points
ID: 36812830
jQuery would be definitely more efficient way to do this.

$('#<%=panel1.ClientID %>').hide();

$('#<%=panel1.ClientID %>').show();

This will show/hide the panel along with the content within the panel.
0
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 300 total points
ID: 36813082
$('#comboID').change(function() {
    //Here you got some options, depending on if the panel must show for an unique value
    //or for a set of values

    //If only one value shows the panel (and all the other values hide it), then it could be:
    if($(this).value == 'value_desired_for_showing') {
        $('#panelID').show();
    } else {
        $('#panelID').hide();
    }

    //If several values show the panel and another ones hide it, you can use
    switch($(this).value) {
        case 'value_showing_1':
        case 'value_showing_2':
        case 'value_showing_3':
            $('#panelID').show();
            break;
        default:
            $('#panelID').hide();
    }
});

Hope that helps.
0
 
LVL 1

Author Closing Comment

by:mikesExpertExchange
ID: 36816926
i split the points, because my main question (the question in the title) was answered with the first response. Though the 2nd response completely answered my entire question (in the question details). Thanks to the both of you for your contributions
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question