After .set_visible(false), .set_visible(true) doesn't work

3 posts, 0 answers
  1. James
    James avatar
    55 posts
    Member since:
    Oct 2011

    Posted 12 Jun 2013 Link to this post

    Hi All,

    Weird problem.  Here's what's up:

    • I hide tabs client side via .set_visible(false).
    • When I go to show tabs via .set_visible(true) -- after the .set_visible(false) -- they do not display.

    Here is my specific function: 

    function v_JobRTS(positiontype) {
     
        var JobRTS = $find("<%=JobRTS.ClientID %>");
        var moretab = JobRTS.get_tabs().getTab(1);
        var finishtab = JobRTS.get_tabs().getTab(2);
     
        if (positiontype == "0" || positiontype == "1") {
             
            //Here is the section that doesn't work.
            moretab.set_visible(true);
            finishtab.set_visible(true);
     
        } else if (positiontype == "2") {
     
            moretab.set_visible(false);
            finishtab.set_visible(true);
     
        } else {
     
            moretab.set_visible(false);
            finishtab.set_visible(false);
     
        }
     
    }

    Here are some things I've tried:

    • Repainting the tab strip.
    • Finding the tabs themselves using different methods outlined in the documentation. 
    • Stepping through the code carefully.

    When I step through the code, it goes right past the desired functions with no effect.

    Thanks,

    Jim
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Jun 2013 Link to this post

    Hi,

    I have tried setting visibility of TabStrip using set_visible(). Here is my code.
    JS:
    function OnClientClick()
     {
        var tab = $find("<%=tab1.ClientID %>");
        var tab1 = tab.get_tabs().getTab(1);
        var tab2 = tab.get_tabs().getTab(2);
        if(tab1.get_visible())
          tab1.set_visible(false);
        else
          tab1.set_visible(true);
        tab2.hide(); // there is hide/show method also.
        return false;
     }
    Note: this change does not persist after a postback.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. James
    James avatar
    55 posts
    Member since:
    Oct 2011

    Posted 14 Jun 2013 Link to this post

    Hi All,

    On a long run, I figured this issue out.  The problem is occurring because I hade the Align property set to "Justify."  If you think about it, it makes sense that the problem might occur.  When the tab control is reduced to 1 tab, that tab will take up 100% of the available space for the TabStrip.  When the remaining tabs are later called to be visible, they have "no place to go," or they seem to be falling "beneath" the initial tab.

    I entirely resolved this by fixing the TabStrip width as well as the tab sizes.

    Thanks,

    Jim
Back to Top