This is a migrated thread and some comments may be shown as answers.

RadTab - set_visible server side

5 Answers 549 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Adrian
Top achievements
Rank 1
Adrian asked on 28 Nov 2012, 10:11 PM
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


5 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 03 Dec 2012, 03:53 PM
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.
0
Adrian
Top achievements
Rank 1
answered on 03 Dec 2012, 04:37 PM
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?
0
Accepted
Nencho
Telerik team
answered on 06 Dec 2012, 02:42 PM
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.
0
Adrian
Top achievements
Rank 1
answered on 06 Dec 2012, 03:11 PM
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
0
jim
Top achievements
Rank 1
answered on 06 Jan 2016, 05:39 AM

it is late but solution given in below link works

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

Tags
TabStrip
Asked by
Adrian
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Adrian
Top achievements
Rank 1
jim
Top achievements
Rank 1
Share this question
or