Solved

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

Posted on 2011-09-28
3
524 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
3 Comments
 
LVL 8

Assisted Solution

by:jagrut_patel
jagrut_patel earned 200 total points
Comment Utility
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
Comment Utility
$('#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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now