Showing posts with label hiding. Show all posts
Showing posts with label hiding. Show all posts

Wednesday, March 28, 2012

Programatically hiding Tabs in TabContainer is not hiding the HeaderText

I wanted to hide/Show one of the TabPanel programatically.

so basically I am doing this.TabContainer.Tabs[1].Visible = false;

Even thought the body of that TabPanel is hiding , the Header Text is still visible without a Tab background.

Please let me know if anyone has found a solution if faced the same problem.

Thanks

Maybe have a look at how the sample does it with script in its ToggleHidden method? Or try the .Enabled property?

it's better to use multiview and view as tab, it's works without problem

this is the code:

MultiView1.ActiveViewIndex = 2

you don't have to hide or show, just send to multiview control the index of the view you want to acitvate.


Actually there is one very simple solution:

tab.visible = false;

tab.headertext=""

And this works perfectly for me.


I use tabPanel._hide() and tabPanel._show(); on the client side. Where tabPanel = $find('tabPanelClientID');

Can anyone tell me how to do the same AND compatible with server refresh of the page... ie. If my client javascript code alters which tabs are visible using _show() and _hide(), then a button to submit the form is pressed can the tab display propertied be maintained across refreshes? hope that makes sense... :)

Currently if I do that above then returned page is reset to the original tab settings.

My scenario is...

I have 4 tabs. as the user selects from various drops downs, tabpanel2 is either hidden or kept shown. the form is eventually submitted to the server and is refreshed, but the tabs are not as they had previosuly been set!!!

I was looking for some kind of proprty like ClientState...?

help


you can also use:

TabContainer1.Tabs(3).Enabled =

False

...then you don't have to hit both the visible and headertext. You also won't have to put the text back that way either.

Dan Ribar


I have a question related to the way you are using the client-side script to show/hide the tabs. I have a tab container (clientID = tcMain) and 4 tab panels (tp1, tp2, tp3, tp4). When I tried to use the following to hide a panel I'm getting a javascript error stating "null is null or not an object". How are you able to resolve the show/hide functions?

My code:

$find('tp2')._hide(); --> failed with the above error

$find('tcMain').get_tabs()[1]._hide(); --> failed with the same error as above

$find('tcMain_tp2')._hide(); --> failed

document.getElementById('tcMain_tp2').style.visibility = 'hidden'; --> failed, could not get visibility property

Can you send me your code?


From the online sample at http://ajax.asp.net/ajaxtoolkit/Tabs/Tabs.aspx:

function ToggleTab(enable, tabNumber) {
$find('<%=TabContainer1.ClientID%>').get_tabs()[tabNumber].set_enabled(enable);
}

hides or shows the tab

function EnableTab(tabNumber)
{
$find('<%=TabContainer1.ClientID%>').set_activeTabIndex(tabNumber);
}

enables the tab which unhides it

would do the trick.

Wednesday, March 21, 2012

Question about the slider extender control and "hiding" the textbox it extends

Copied and pasted from the interactive sample pages, under slider tips:

TextBox visibility. The asp:TextBox that the Slider is upgrading will be visible during the page loading, so it is usable if JavaScript is not enabled on the browser. Depending on your requirements, you can prevent the asp:TextBox from being visible by setting its display mode to "none".

However, there is no display mode or displaymode property for the textbox control, nor for the slider extender. How then can I prevent the textbox from being visible while the page is loading?

Another question: is there a way to set the slider to enabled = "false" where it would show the value (e.g. the slider being at the middle of the rail for a value of 50%) without it being movable? I tried setting the textbox to enabled = false. The slider looks somewhat grayed out, but you can still click on the slider and move it. Thanks a lot.

Hi,

1) display is a CSS attribute. you should set display:none on the extended TextBox.

2) At the moment the slider can't be disabled, but this is a good suggestion.

Thanks.


Ah thanks. Forgot about the css attribute for that.

As for the slider not being enabled or disabled, I guess I'll just make it invisible for now.