Solved

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

Posted on 2011-09-28
3
526 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

911 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

24 Experts available now in Live!

Get 1:1 Help Now