Posted by Nazar Rizvi on 10/12/2007 3:27 AM | Comments (34)

I had this issue where I wanted more than one row of headers in the TabContainer as I had a large number of panels and was not able to fit them in the page.

Here is the solution. [make sure you download the toolkit with source]

Open the AJAX Control Toolkit's solution by clicking on the solution file inside the toolkit folder.  

Open the file Tabs.css under AjaxControlToolkit/Tabs/Tabs.css

And make the following changes.

/* default layout */.ajax__tab_default .ajax__tab_header {}
.ajax__tab_default .ajax__tab_outer {display:-moz-inline-box;display:inline-block}
.ajax__tab_default .ajax__tab_inner {display:-moz-inline-box;display:inline-block}
.ajax__tab_default .ajax__tab_tab {margin-right:4px;overflow:hidden;text-align:center;cursor:pointer;display:-moz-inline-box;display:inline-block}

Now click on Build -> Build Solution to build the solution.


Use the AjaxControlToolkit.dll under ToolkitTests/Bin folder as your reference from now on.


Add this dll file as reference to your current website and you should have the 2 rows.


 

 

Comments (34) -

auband
auband Norway on 12/28/2007 2:41 PM This is very good! One thing, is it possible to do this in a separate css file included in my project and not in the "original"? I've tried and I can style the TabContainer as I like, except for the css-classes in your article. Any changes to these in my cutsom css file seem to be ignored!
Nazar
Nazar United States on 12/30/2007 8:35 AM Auband...

Yes, you are right when we try to create seperate classes and implement it. It doesn't allow us to do it. I too thought we could alter it but wasn't successful. Maybe someone else might have a better solution.
ro
ro Hong Kong S.A.R. on 1/17/2008 4:48 AM it is very useful for me
Nazar
Nazar United States on 1/21/2008 11:38 PM Ro,
Good to hear that
atul
atul India on 1/27/2008 11:09 AM it is very good and useful
but i want paging to tab is it possible?
how?
any idea?
Thanks...
Nazar
Nazar United States on 1/28/2008 12:56 AM Atul:
Do you mean paging enabled with different tabs displayed for different pages ???
Avinash
Avinash India on 2/15/2008 12:27 AM i want to customize i-e, colouring the tabs,  can u give me some idea how to do that....
Nazar
Nazar United States on 2/21/2008 1:01 PM Avinash:
Nice idea. I shall look into it and inform you.
Sreedhar Vankayala
Sreedhar Vankayala United States on 3/8/2008 11:14 AM Hi,

Great example, out of curiosity, can't we add in out custom css files the lines you mentioned ...

/* Custom Css */
/* default layout */.ajax__tab_default .ajax__tab_header {}
.ajax__tab_default .ajax__tab_outer {display:-moz-inline-box;display:inline-block}
.ajax__tab_default .ajax__tab_inner {display:-moz-inline-box;display:inline-block}
.ajax__tab_default .ajax__tab_tab {margin-right:4px;overflow:hidden;text-align:center;cursor:pointer;display:-moz-inline-box;display:inline-block}

Cheers,

Sreedhar Vankayala
Chuck Barest
Chuck Barest United States on 5/7/2008 9:57 AM Good article Nazar!

FYI, Sreedhar and others - I simply added the following "white-space" settings to the first line of your CSS example and it worked in my website's CSS with me having to compile a new AJAX .dll:

.ajax__tab_default .ajax__tab_header {white-space:normal!important;}

Kindest regards,
Chuck Barest
Vijay
Vijay India on 5/12/2008 11:04 PM Hi,
Thanks for the post..Is it possible to display only one tab row at a time and other rows with scrolling option.Something like IE7 tab bar?

Thanks in advance
Ako Kamangar
Ako Kamangar Iran on 5/30/2008 12:04 AM Thanks Nazar and thanks Chuck Barest, it helped very much.
Nazar
Nazar United States on 5/31/2008 3:21 AM Chuck:
Yep good one there. Works fine when I tested it out too. Thanks for digging into it.

-Nazar
Nazar
Nazar United States on 5/31/2008 3:23 AM Vijay:

What exactly do you want to achieve???
mike
mike on 6/12/2008 3:00 PM The only problem? The row with the least amount of tabs should be on top. But that's inmpossible.
Nazar
Nazar United States on 6/12/2008 7:42 PM Mike:

Yes you are right. We can not achieve that. Maybe there is another hack which we don't know. But logically speaking it can not be achieved.

[But we know everything can be achieved in programming one way or the other]
dos çal??t?r
dos çal??t?r Turkey on 6/27/2008 5:15 PM css Cursor examples , Properties , Attribute   - - css-lessons.ucoz.com/cursor-css-examples.htm
riddy
riddy Ukraine on 7/9/2008 7:07 PM <samp>
i just add in my *.ascx file

tag at the top:
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/.../xhtml1-transitional.dtd">;

then:
style type="text/css"
    .ajax__tab_xp .ajax__tab_header {white-space:normal;}
/style>

and:
...
ajaxToolkit:TabContainer runat="server" ID="GIListTabs" Width="100%" CssClass="ajax__tab_xp"
...

Thats is all. Good luck!!
arluijen
arluijen on 7/10/2008 5:55 PM Riddy,

Excellent, I didn't want to recompile my ControlToolkit, so your solution is the easiest.

Cheers
Nazar
Nazar United States on 7/16/2008 1:46 AM Riddy thats another way to do it. Doing that will just overwrite the existing CSS of tab control. If this functionality is required on one page you can do that.
Abidali
Abidali India on 10/22/2008 2:49 AM Hi,
Nazar

Excellent work,
Keep it up
Rodger Cespedes
Rodger Cespedes Costa Rica on 11/12/2008 2:21 PM Hi Nazar,

Thanks !!!
Excelent Work !!


Cheers,



Edwill
Edwill South Africa on 11/25/2008 4:21 PM Thank you, this is exactly what I needed!!
levi
levi United States on 11/27/2008 4:14 PM Is there any reason why this wouldn't work within a master page?  I've tried both riddy and Chuck Barest's solutions without luck.  I've tried adding the style in-line in the master page and also within my external CSS stylesheet.
Nazar
Nazar United States on 12/8/2008 4:12 PM I have mine in a masterpage and it works perfectly fine. Is there anything which we are missing.
steve staple
steve staple United Kingdom on 12/12/2008 9:15 AM /* default layout */.ajax__tab_default .ajax__tab_header {}

.ajax__tab_default .ajax__tab_outer {display:-moz-inline-box;display:inline-block}

.ajax__tab_default .ajax__tab_inner {display:-moz-inline-box;display:inline-block}

.ajax__tab_default .ajax__tab_tab {margin-right:4px;overflow:hidden;text-align:center;cursor:pointer;display:-moz-inline-box;display:inline-block}


I have tried using the above but get loads of errors:

'-moz-inline-box ' is not a valid value for the display property.
'overflow-x' is not a known CSS property name.
'overflow-y' is not a known CSS property name.
Imran
Imran on 2/9/2009 1:40 AM Thanks i find this from lot of search..
kets
kets South Africa on 2/17/2009 9:26 PM hi there

i have tried everything here.. but it still wont create multiple levels of tabs.

what am i doing wrong?

i change the white-space value in tabs.css file that sits on my c: drive.. then i build the project and run it... and the panels do not wrap... anyone have any ideas?
magrata
magrata United States on 2/18/2009 9:01 AM Hi Nazar,

Thanks for the nice article!! I have a page in which I have the Ajax tab control with 4 tabs. Within each tab control I have a gridview with one of its field as hyperlink. Now when I click on the hyperlink it goes to Page1.aspx. I have a back button in that page which takes me back to the parent page, but if I clicked the hyper link from tab 3, on returning through the back button the active tab resets to tab 1. Is there any way I can remember the current active tab from which the hyperlink was clicked on returning through the back button??

Thanks in advance..
Nazar
Nazar United States on 3/1/2009 3:43 AM Kets:
You need to build the AJAX dll. Did you build the ajax dll or your own project?

Magrata:
I totally understand your situation. The control does not provide us that much flexibility. What you can do is have something saved in Session and load that tab or some other HTML hack job(I do not think this would work but you can give it a try).

Mukund
Mukund India on 6/18/2009 1:53 PM Within that update panel control I have a Tab-Container with 5 tabs. All 5 tabs have 1 gridview that is filled on load. If I filter the gridview in the 4th or 5th tab the content from tab 3 is also displayed in tab 4 or 5. If I change the tab and go back the output is correct again.I am using IE 7 and 8 and on both browsers the problem appear. Do you have a idea why that happen and how I can fix that?Thank you!
suresh
suresh India on 6/23/2009 1:56 PM In design view style sheet has effect but in browser its dsplayin as previous one can help me?
Nazar
Nazar United States on 6/28/2009 9:08 AM Suresh, which browser are you using and can you provide sample code or more detail?
Kevin
Kevin United Kingdom on 8/25/2011 8:24 AM It Works!!!!!!
Step 1.Place the css style tag in-between the 'head' tag of you page:
<head id="Head1" runat="server">
  <style type="text/css">
    .ajax__tab_xp .ajax__tab_header {white-space:normal!important;}
</style>
</head>

Step 2. set the CssClass to default as shown below:
<AjaxControlToolkit:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="14" CssClass="ajax__tab_xp" Width="654px">

There you have it. Enjoy coding.
Always make complex stuff easy for others to learn.
Cheers!!!!!!!!

Pingbacks and trackbacks (8)+

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading