Solved

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 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