RadTab - set_visible server side

6 posts, 1 answers
  1. Adrian
    Adrian avatar
    4 posts
    Member since:
    Aug 2012

    Posted 28 Nov 2012 Link to this post

    Hello,

    I'm using a RadTabStrip control and I need to hide and show tabs according to a condition and I need it to be using java script, so I'm doing this:

    function changeTabVisibility(radTabStripID,tabValue,visible) {
        var tabStrip = $find(radTabStripID);
        var tab = tabStrip.findTabByValue(tabValue);
        tab.set_visible(visible);
    }

    The problem is that not all the tabs are going to be showed at the beginning, so I need to hide them server side, and if I do a serverTabVariable.Visible=False then is going to fail when I try to set it as visible because the control was never render to the browser.

    Basically my question is how can I simulated a tab.set_visible(false); but server side?

    I tried doing something like this but it didn't work:

    serverTabVariable.Attributes.Add("style", "display:none;"), the tab is been rendered as hide but then I can't set it back to visible.

    I hope it is all clear.

    Regards,
    Adrian Calvo


  2. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 03 Dec 2012 Link to this post

    Hello Adrian,

    As you well guessed, when you set the Visible property to false, the RadTab is not rendered on the page, and could not be accessed on a later stage. For that matter, I can suggest you to manage the visibility of the RadTabs at client-side, with the help of the set_visible() method.

    All the best,
    Nencho
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adrian
    Adrian avatar
    4 posts
    Member since:
    Aug 2012

    Posted 03 Dec 2012 Link to this post

    The problem is that I need to send the RadTab as invisible from the beginning (based on server side logic) and then be able to change its visibility at client side.

    Any idea?
  5. Answer
    Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 06 Dec 2012 Link to this post

    Hi Adrian,

    One possible implementation is to hide a certain RadTab by setting the Width property to "0px" and restore the initial value at client-side, when needed. I have prepared a sample project, in order to demonstrate you this approach. Please find the sample attached.

    Regards,
    Nencho
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Adrian
    Adrian avatar
    4 posts
    Member since:
    Aug 2012

    Posted 06 Dec 2012 Link to this post

    Thanks, but I ended up using the OnClientLoad event from the RadTabStrip object, and I'm passing an array with the tab values that needs to be hided, that way I can call the method set_visible client side:

    function rtsOnClientLoad(sender, tabsArray) {
        for (var i = 0; i < tabsArray.length; i++) {
            var tabValue = tabsArray[i];
            var tab = sender.findTabByValue(tabValue);
            tab.set_visible(false);
        }
    }

    So far is working fine
     
    Thanks for your help,

    Adrian
  7. jim
    jim avatar
    11 posts
    Member since:
    Jun 2012

    Posted 05 Jan Link to this post

    it is late but solution given in below link works

    http://www.telerik.com/forums/radtab-server-side-hide-client-side-hide-show

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017