Search code examples
jqueryasp.netajaxcontroltoolkitaccordion

possible to use jquery to show/hide ajaxcontroltoolkit accordion?


I have an AjaxControlToolkit that I'd like to show or hide based on a dropdown value.

I was able to sort of get it to hide by changing the text of the "ShowLinkButton" control (using a blank "" where I wanted to hide the accordion), but I'd like to hide the accordion itself. (The accordion is clickable even when the text is blank.)

So, here's my jquery code:

$(function() {
    if ($('#<%= DDStatusList.ClientID %>').change(function() {
        var statusval2 = $("#SampleContent_Tabs_TabPanel3_DDStatusList").val();
        if (statusval2 == 4) {
            $('#<%= ShowLinkButton.ClientID%>').html("Show Accordion");
        }
        else {
            $('#<%= ShowLinkButton.ClientID%>').html("");
        }
    }));
});​

I've tried to make both the Accordion's and the LinkButton's visible property = false, and then make it true when the condition is met in the jquery function, but neither strategy seems to work.

Thoughts?


Solution

  • thanks, all.

    I wound up doing this:

    if ($('#<%= DDStatusList.ClientID %>').change(function () {
                                            var statusval2 = $("#MainContent_Tabs_TabPanel3_DDStatusList").val();
                                            var statusvalcurrent = $("#MainContent_LabelStatusNumber").text();
                                            if (statusval2 == 4 && statusvalcurrent == 4.3) {
    
                                                $('#<%= status43panel.ClientID%>').show();
    
                                                //alert("show");
                                            }
                                            else {
    
                                                $('#<%= status43panel.ClientID%>').hide();
    
                                                //alert("hide");
                                            }