Adding Button only to selected tab in Tab Control?

I'm using the Tab Control and I'm creating Tabs dynamically.

I've just figured out how to use Headertemplates on my dynamically created tabs. I have some headertext and an ImageButton (close button) in my HeaderTemplate. But I only want that ImageButton to be visible on the selected tab.

In code behind I can easily make different HeaderTemplates depending on weather the tab is selected or not, but then I have to enable AutoPostBack on my TabContainer and that's not something I  wanna do. Smile

Is there a way to hide my ImageButton on all tabs except on the selected one...or something?


John a.k.a. "Raxxa"
8/7/2008 10:51:04 AM 17816 articles. 1 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 4


You may use the FindControl method and pass the name of your ImageButton to find that button and set it's visibility to false.

 I hope it helps.


8/7/2008 11:43:03 AM

Yes, but that requires a postback to the server every time I select a new tab...I don't want that

I'm looking for a way to do this with client side code only. I'll be using the OnClientActiveTabChanged event on my TabContainer....and then I guess I'll have to write some Javascript and CSS to hide/show the button somehow. But I don't know how to do it!

OR do I have to modify the AJAX Tab Control source code and stuff???!!


John a.k.a. "Raxxa"
8/7/2008 2:19:52 PM

Solved the problem myself by putting the ImageButton in a div tag and set its style property to "visibility: hidden". And then I wrote som JavaScript for the OnClientActiveTabChanged event on the TabContainer where I set the visibility of the div tag to "visible" for the active tab

Like so:

function SaveActiveTabIndex(sender, e)
        var activetabindex = sender.get_activeTab().get_tabIndex();

        var tabs = sender.get_tabs();
        var divId = "";
        for(i = 0; i < tabs.length-1; i++)
            divId = "deletediv_" + i;
            if(i != activetabindex)

John a.k.a. "Raxxa"
8/11/2008 12:55:57 PM

Similar Artilces:

Tab Control
I have searched the forum and I cant seem to find the answer to my question, although I have tried some of the hints I have found with no luck....Can someone show me a working sample (with source code) of a page with a TabContainer and several tabs, with each tab having a user control, but the controls are not added/initialized/shown until the appropriate tab is shown/clicked?Something like this forum's "Write a New Post" page, where the tabs load after I click on them, and an animated picture displays to show that its loading.The solution needs to add user controls to the page...

Name: Danny Email: danheidiatrogersdotcom Product: Thunderbird Summary: TABS, TABS, AND MORE TABS. Comments: Hi Why is it that EVERYTIME I get a new upgrade whether on Firefox or Thunderbird, I get TABS? I now have an upgrade on Thunderbird and guess what, I have an 'Inbox' TAB that i don't know how to get rid of. Any ideas? Another issue is. Why doesn't Firefox display something telling me it is working/looking for the site I want. I click on a site and stare at Firefox and don't know if it is doing anything. The previous versions were mu...

Tab Controls
Hello - I'm using PB 6.5. I can't get the selectedtab property to work in any event. I want a different tabselected to show based on what menu item is selected. I have put tab1.selectedtab=X in several events and none of them will cause ANY tab to be selected and have focus. Not until one of the tabs is clicked, does this work. There seems to be something going on in the opensheet command. Anyone have any ideas? THANKS ---== Posted via the PFCGuide Web Newsreader ==--- Have you tried SelectTab()? Let us know, Terry...

Tab Controls/tab pages/controls within tab pages
I give up! I have a tab control user object - inherited from u_tab - and some tab pages. Initially only one page is enabled which has a datawindow. When a valid data is entered in the DW, I need to enable rest of the tabs - Now - it is giving me a NULL object reference error during execution for the following statement in an event of the DW - tabcontrol.tabpage.enabled=TRUE getparent( ) also giving errors - HELP! How can I do this? Thanks! Ragni Ragni -- If you have CreateOnDemand set for the tab, then the tab pages are not valid until the user accesses them. ...

Tab strip control
i am using a tabstrip control to which the tabs are added dynamically depending upon the condition matched. but in the tabstrip1.SelectedIndexChange event, i am not able to acces the selected index properly. the selected index returned to me on any tab click is zero or the index of the first tab. what can be done to deal with this problem?   plz help. thanx in advance. Sachin....

Tab control/selected tab page problem
First thing, we are using PB 6.0. When using tab controls, we cannot cause any tab page other than the one in index position 1 to be selected when opening a window. We have tried posting events that will perform the code after the window is visible, to no avail. I even tried using the movetab() function as a last resort. That worked, almost. It brings the tab page I want selected to the first position (the other tab pages are disabled, by the way). Then, when the user clicks a radio button, certain other tab pages are enabled. When they are enable, though, they get moved before t...

Adding tabs to Tab Control server side
Does anyone know how to add tabs to the tab control from the server. I want to be able to create dynamic tabs based on data from a table. I tried using the tabstrip.items.add method, but it expect a tabitem type and you can not do a new on this type of class as it has to be inherited. Thanks, Ott I figured it out. Thanks Hi, How do you solve this? I had same problem. Thanks.Richard XinMCAD(charter member),MCDBA,MCSDWeb Site: (For ASP.Net tips and Code snippet) hi and....? whats the solution?...

Tab control tabs
Hi, Is there a way to show the tabs of a tab control on the left (instead of the default “top”)?  (Something like the “Customer & Partner Solutions” on )  Thanks, Z That’s nice… But I meant is it possible to do it with the AJAX tab control?  ...

tab container controls images are not transparent for selected tab
Like the title says the tab controller if you have a colored back ground wierd white line shows up on the corners for the selected tab. i posted as an issue in codeplex  ...

Changing Tab control's Selected Tab property
My window has got a tab control with three tab pages. The default Selected Tab property is set as 1. While opening the window ( in Window Open Event), When I tried to change the Selected tab property to 2 , It is not working. Why ? //Window Open Event tab_1.SelectedTab = 2 Rgds. Try tab_1.POST SelectTab(2) <FRANKLIN> wrote in message > > My window has got a tab control with three tab pages. The > default Selected Tab property is set as 1. While opening the > window ( in Window Open Event), When I tried to chan...

Tab after tab not..
Name: steve Email: xilleratproquakedotde Product: Firefox Summary: Tab after tab not.. Comments: Hello, could you add the funktion, that the new TAB come after the TAB what in use is. [sorry my engl.] i mean: i have 10 TABs open. and i klick in the middl nr. 5. Now i open a LINK in this TAB. At the moment the new TAB gos to TAB11 and not 6. Understand? :) thx Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv: Gecko/20070914 Firefox/ ...

Tabs!! TABS!
Name: Kathy Email: kmhuntingtonatgmaildotcom Product: Firefox Summary: Tabs!! TABS! Comments: I know I can find the "always show tabs" in the tools drop-down, but argh! It took me a few moments to find it. You probably had that noted somewhere and I didn't bother to read it, so I have no one to blame but myself, but still! Argh! Tabs are hidden! Do you know how many times my mother is going to call me asking for help? TOO MANY! Anyway, thank you. I love FF. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1) Gecko/20090615 Fi...

Keep selected tab after page refresh for Tookit Tab control
 How would you keep the currently selected tab from changing on page reload.  Right now, I have nested tabs and when I refresh, it goes back to the first tab every time and does not maintain state (selected tab).I hope there is a much more practical/easier way to maintain state for the tabs both client-side or server-side than this: When is Microsoft going to get rid of VB.NET!  I'm starting to think the Tab control is a complete pain in the ass.  Can anyone answer this question easily?  I can't ...

Changing Tab control's Selected Tab property
PLEASE EXCUSE ME : I AM CROSS POSTING, BECAUSE PROBLEM NOT SOLVED. My window has got a tab control with three tab pages. The default Selected Tab property is set as 1. While opening the window ( in Window Open Event), When I tried to change the Selected tab property to 2 using the following two options, it failed. Why ? //Try_1: //Window Open Event tab_1.SelectedTab = 2 //Try_2: //Window Open Event tab_1.POST SelectTab(2) Rgds. VPNB SelectTab() works for me. Are you sure your window is redrawing? Good luck, Terry [TeamSybase] and Sequel the techno-kitten ...

Web resources about - Adding Button only to selected tab in Tab Control? -

Portal:Bollywood/Selected biography - Wikipedia, the free encyclopedia
Write three or four paragraphs in the text field using information from the selected notable article, you may find it useful to examine the existing ...

F8: Facebook’s FbStart Initiative Will Give Selected Developers A $30K Kick-Start
... successful applications is likely a whole lot easier with $30,000 in free tools and services to start off with, and that’s exactly what selected ...

LEGO Shop - The LEGO Technic team has selected the winner... - Facebook
The LEGO Technic team has selected the winner of the Co-Creation Challenge! LEGO will be producing a limited run of 20,000 of this stunning set.... ...

Grand Doctor Ma Selected Students-baby365 on the App Store on iTunes
Get Grand Doctor Ma Selected Students-baby365 on the App Store. See screenshots and ratings, and read customer reviews.

Selected Cheney Vice Presidential Photographs
... for photos found within these albums are Paul Morse, Karen Ballard, Kimberlee Hewitt, Shealah Craighead, and Chris Greenberg. These selected ...

[iOS Advice] How To Clarify Your Email Replies By Quoting Selected Text - YouTube
Follow me on Twitter: Like my Facebook page: RATE, COMMENT, SUBSCRIBE! :-) ...

UAE Under-19 cricketers for ACC Premier League tour of Malaysia selected - The National
Coach Aaqib Javed seeking fresh blood for senior team after missing out on World Twenty20

Animal of the Day: Lucius Has Been Selected as the U.K.’s ‘Happiest Cat’
He’s got one blue eye, one green eye and a heart of gold. British mobile phone company O2 recently held some “cat auditions” to find “the UK’s ...

Australian director Sue Brooks 'gobsmacked' as Looking for Grace selected for Venice Film Festival competition ...
... filmmaker Sue Brooks says she is "gobsmacked". Her drama Looking For Grace , shot in the Western Australian wheat belt, has been selected for ...

Three Canberra products selected in AFL state combines
Belconnen junior Chris Jansen has been selected in South Australia's state AFL combine.

Resources last updated: 12/26/2015 4:07:59 AM