Programmatic rendering of the tab control does not show the tab styling

Posted on 2007-08-02
Medium Priority
Last Modified: 2008-01-09
Hi Guys,

The following code does not render the styles of the tab.
They look like hyper link but works a tabs.

public AjaxControlToolkit.TabContainer CreateWorktabs()
AjaxControlToolkit.TabContainer TabContainer = new AjaxControlToolkit.TabContainer();
AjaxControlToolkit.TabPanel TabPanelWorks = new AjaxControlToolkit.TabPanel();
AjaxControlToolkit.TabPanel TabPanelRequest = new AjaxControlToolkit.TabPanel();
AjaxControlToolkit.TabPanel TabPanelTasks = new AjaxControlToolkit.TabPanel();
 TabContainer.Width = Unit.Pixel(700);
TabContainer.Height = Unit.Pixel(540);

TabContainer.CssClass = "ajax__tab_xp";
//TabContainer.Attributes.Add("Style", "strstyle");
// TabContainer.Attributes.Add("CssClass","ajax__tab_xp");
TabContainer.BorderStyle = BorderStyle.NotSet;
TabContainer.ActiveTabIndex = 2;

TabPanelWorks.HeaderText = "Works";
TabPanelWorks.ID = "tabPanelWorks";
TabPanelRequest.HeaderText = "Request";
TabPanelRequest.ID = "TabPanelRequest";
TabPanelTasks.HeaderText = "Task";
TabPanelTasks.ID = "TabPanelTasks";
return TabContainer;
Question by:FunCoder
  • 3
  • 2

Accepted Solution

garthjh earned 1000 total points
ID: 19620960
Is the style sheet in which the css class you are attempting to use linked to the page where the tabs live?  Also, not sure if you meant to do this, but aren't the lines where you are adding the style attribute commented out?  Finally, I believe tabs are all rendered as links, so you may have another style for 'a' in your style sheet that is overriding the specific class you mention in the code.  I think 'a' modifiers are last in the hierarchy so they will override any specific classes assigned.

For example:

a { color:red }
.mystyle { color:blue }

will render a red link if 'mystyle' is applied to a hyperlink, where:

a { color:red }
.mystyle a { color: blue }

would render a blue link.

Author Comment

ID: 19623622
//TabContainer.CssClass = "ajax__tab_xp";
            //TabContainer.Attributes.Add("Style", "strstyle");
was commented out cos I tried it
I added  .a tag stuff as well


Expert Comment

ID: 19628624
Okay, if you have the toolkit installed where you are deploying or testing, it should have a default stye sheet which is probably not getting picked up by your page.  http://ajax.asp.net lists the default styles in here: AjaxControlToolkit\Tabs\Tabs.css.  You'll want to ensure that the default styles for the tab controls are incorporated into your own style sheet if the toolkit css is not included in your deployment.

Author Comment

ID: 19641366
It is almost working now except that, it only works when you refresh the page using F5.


Author Comment

ID: 19641369
It is almost working now except that, it only works when you refresh the page

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Strategic internal linking is often considered an SEO power technique, especially for content marketing. Do you need to hire an SEO agency to optimize you internal linking? No, this article will help you understand the basics of internal linking and…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question