Showing posts with label tabs. Show all posts
Showing posts with label tabs. Show all posts

Wednesday, March 28, 2012

Tab container & Tab panel

Hi

I am trying to customize look n feel of tab panel's Header Text -- by giving a hover effect or a different background image to tabs. I could not see any way of achieving it.

Where is the location of class ajax__tab_xp? If I create my own class, the separate tabs disappear.. How to apply or modify the stylesheet class??

Thanks in advance for your help.

Anyone guyz? AJAX experts? Please help.

I will greatly appreciate a line of working code for this.. Thanks in advance.


Hi,

Here is a code snippet demonstrate using custom style on tabContainer.


<style type="text/css">
.ajax__tab_xp2 .ajax__tab_header {
font-family:verdana,tahoma,helvetica;
font-size:21px;
background:
repeat-x
bottom;white-space:normal;
}
.ajax__tab_xp2 .ajax__tab_outer {
border-style: solid double;
padding-right:4px;
background:
no-repeat
right;
height:21px;
}
.ajax__tab_xp2 .ajax__tab_inner {
padding-left:3px;
background:
no-repeat;
}
.ajax__tab_xp2 .ajax__tab_tab {
height: 100px;
padding:4px;
margin:0;
background:
repeat-x;
}
.ajax__tab_xp2 .ajax__tab_hover .ajax__tab_outer {
background:
no-repeat
right;
}
.ajax__tab_xp2 .ajax__tab_hover .ajax__tab_inner {
background:
no-repeat;
}
.ajax__tab_xp2 .ajax__tab_hover .ajax__tab_tab {
background:
repeat-x;
}
.ajax__tab_xp2 .ajax__tab_active .ajax__tab_outer {
background:
no-repeat
right;
}
.ajax__tab_xp2 .ajax__tab_active .ajax__tab_inner {
background:
no-repeat;
}
.ajax__tab_xp2 .ajax__tab_active .ajax__tab_tab {
background:
repeat-x;
}
.ajax__tab_xp2 .ajax__tab_container .ajax__tab_default {text-align:center; background-color:Blue;white-space:normal;}
.ajax__tab_xp2 .ajax__tab_body {text-align:center; background-color:Blue; font-family:verdana,tahoma,helvetica;font-size:10pt;border:1px solid #999999;border-top:0;padding:8px; border-style:none; border-color:Green; border-bottom-style:none; border-left:none; border-right:none; border-top:none; }
.ajax__tab_xp .ajax__tab_body {
font-family:verdana,tahoma,helvetica;
font-size:10pt;
border:1px solid #999999;
border-top:0;
padding:8px;
background-color:#ffffff;
}
</style>

<ajaxToolkit:TabContainer CssClass="ajax__tab_xp2" ....................


This question is being asked soooo many times...

Maybe this'll help:

http://forums.asp.net/t/1163303.aspx

And maybe someone should put this in the FAQ (if it isn't already there)..


Thank you Raymond.. your post has solved my problem 95%.. great!

Quick question, on Hover I have:

.ajax__tab_xp2 .ajax__tab_hover .ajax__tab_inner {
/* background:no-repeat; */
font-weight:bold;

due to this, all tabs move or drift little bit (due to font weight change) on Mouse Over.
How can I avoid this?

Thanks & I mark this as answer!Yes


Thank you NNM, for the post link. I totally agree with other member -- TabPanel/Container controls are so "non-intuitive" .. if changing style on tab control must be done through css then why can't MSFT write a single line or provide a sample in their AJAX demos!! I spent freaking hours in figuring this out ...

Believe it .. I am gonna have questions when I start actual coding with Tab Controls! ..Hmm

Sam


sdekha76 :

Try changing thepadding value. There's no fixed answer to padding value, since I think it depends on the font size.

edit: the tab styling may seem non intuitive at first, but once you play around with it a bit, you'll be able to customize it completely, even changing the background images. I really love this toolkit control.

Tab Container Header tabs NOT on multiple rows

This is driving me crazy. I have a webpage that has a table on it. Inside the table I have a TabContainer. I have 13 tab headers I need for the one TabContainer. I populate the tab headers by a call to the database then doing a For Loop to enter all the headers. The problem is that when I run the app the tab headers are all on one row. How do I get the Tab Headers to split up into two rows?

Thanks in advanced.

mutlyp

Hi mutlyp,

As far as I know, there is no build-in support for this feature currently. You can votehere.


Hi Raymond

I actually found the answer but it took a lot of digging on the net. It's from Nazar Rizvi's blog

http://www.narizvi.com/blog/post/Two-rows-of-tab-headers-in-TabContainer-in-Ajax-Control-Toolkit.aspx

You have to go into the Tab.css and change the ".ajax__tab_default.ajax__tab_header {}" line. Then the Tab headers will wrap.

Funny how Nazar knew this and you a Microsoft rep didn't. Maybe you guys should hire Nazar.


Mutlyp,

Thanks for that link...

Regards

Karen


Thanks for sharing, it's so helpful.

Tab Container Javascript Error: Unspecified Error

I keep getting this error when I try to view a certain page with IE7. I do not get the error with Firefox 2. I have two pages that have tabs, but only receive an error on one of them. It occasionally works with no problems. If I set the first panel's visible property to false, then it works fine. The first panel contains an 2 update panels with a filtered text boxes, an update panel with a calendar extender, and an update panel with a mask edit extender and mask edit valuator. I also use framesets. Could any of this be causing the error? Does anyone know a work around?

I have found that the Masked Edit Extender is causing the error. Can I use this inside a tab panel? Is there something special I need to do to use it? If it's not possible, does anyone know of anything similar that would work in its place?

Tab Control

Does anyone know how to make the tabs on a TabControl that comes with the Ajax control toolkit to display its tabs on multiple rows and not just on one long row?

Thanks in advance

your're not the only one... vote here!

http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=8843

Big Smile

Cheers!


Thanks. Hope we get the feature Soon!

Tab Control - AjaxControlToolkit

Hi All,

I am using Tab control in asp.net ajax. I have two tabs and each tab has a gridview. Both the gridview is binded to Datasource, both has paging but only one grid paging is working the other one is not working.

Even the second grid paging event is fired, new dataset is binded to the grid but it is not reflected in the grid.

Why is this?

Any one has any idea on this?

Regards,

Techwork.

Hi All,

I found out soem what the cause for that but could not find the reason for that.

I am using the Active Tab Changed event to bind the grid whenever the postback happens, but the event is not getting fired in some cases.

If that event fires properly my issues are solved.

I used the clientside event to fire the server side event but no use, in that case Active Tab Changed event is not getting fired at any time.

I am creating the tab control dynamically, will that be a problem.

Same I tried by creating statically it is working.

regards,
Santha

Tab Control - Enable/Disable Tab on Client

I'm using the AJAX Toolkit TabContainer control and would like to enable/disable tabs on the clientside. I have tried document.getElementById('MyTabContainer').get_tabs()[1].set_enabled(true), but I get the error "Object does not support this property or method." Just to try to capture the appropriate object, I added the OnClientActiveTabChanged="switchTab" attribute to my TabContainer. Then, in JavaScript I wrote a switchTab function: function switchTab(sender, e){ ... } Thesender passed into the switchTab function is the actual TabContainer object I need, and from that I can enable/disable tabs. My problem is I can't figure out how to retrieve the TabContainer object other than capturing the object when sent into the switchTab routine. Any ideas?

Finally solved my own problem, and it was right there in the sample Tab application in the Control Toolkit: http://ajax.asp.net/ajaxtoolkit/Tabs/Tabs.aspx. I was able to find the object I needed in JavaScript using the $find method, as similarly done in the demo with the following snippet:

function ToggleHidden(value) {
$find('ctl00_SampleContent_Tabs').get_tabs()[2].set_enabled(value);
}

Monday, March 26, 2012

Tab Control - Change active tab

Hi,

I have a quick question that I am hoping will have an easy answer.

I have a form with a tab control and 3 tabs. What I would like to do is have a button on one of the tabs change the active tab.
So under tab 1 the users clicks the button which will bring them to tab 2. I know they can just click on the tab header at the top however I want to do some quick validation of information before making that tab visible and switching focus to it, is this possible?

Regards,

Daryl

function SetTabIndex(index)
{
var tabs = $find('TabContainerClientID');
tabs.set_activeTabIndex(index);
}
Thank you Jason!

Tab Control Change Tab Colors

I have a customer that wants the Tab Control to have specific colors for the tabs depending on which tab is clicked. I have been able to use the CssClass to get the hover to be the way they would like but the active tab they would like it to be a different color.

I have attempted to write VB behind code as follows

sub onTabChange(byval sender as object, byval e as system.eventargs)

Select Case TabContainer1.ActiveTab

Case 1

TabContainer1.CssClass = "ajax__tab_tab1"

Case 2

......

end sub

I have the Sub as the onActiveTabChange property of the tab control. I do not get any debugging stop in the code behind page or any indication that there is a call to the sub from the control.

I just need a way to change the colors on each tab depending on which tab is active.

Hi,

Please make sure the AutoPostBack property of the Tab control is set to true.

If this doesn't work, please post a stripped version of your page here.


The autopostback property was the resolution

Thank you.

Tab Control is throwing an exception on postback

I have a tab container control on my page located within a view. When the view is activated I do a query and dynamically add the tabs based on a query like so:

 DataTable tblCollAttrs = oBAL.GetCollectionAttrs(DetailItemID);foreach(DataRow drowin tblCollAttrs.Rows) { TabPanel collTabPnl =new TabPanel(); collTabPnl.HeaderText = drow["vchAttributeName"].ToString(); relTablContainer.Tabs.Add(collTabPnl); }

So far everything is fine. Now I click an unrelated button which does a full postback that switches the view and I get this exception:Specified argument was out of the range of valid values. Here is where it is crashing in TabPanelCollection.cs:

public new TabPanel this[int index]
{
: get { return (TabPanel)base[index]; }
}

What am I missing here?

Unfortunately, the tab control does not play nice with dynamically added tabs. It does not re-create them during pre-init, and when it goes to set the active tab, you get the error you are seeing because the active tab index is greater than the number of tabs.


Is there anyway around this?


HiI have also this problem.please help me.

Because of this limitation I was unable to use this AJAX control. I ended up creating my own TabStrip control and putting it in an UpdatePanel.

Sorry I don't have a better response.

Tab Control is rendering very very slow on page

Hi,

I have added a tab control with 5 tabs on the page. But after that now page is taking very very long time to load in browser.

All of the pages where I have added Tab control are loading very slow !!

Is there any way to get rid of this ?

Regards,

Naimish Dave

Same problem here. Apparently, it's because of IE's slow javascript parser.

http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=9955

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" onhttp://www.microsoft.com/en/us/default.aspx )

Thanks,

Z

http://deluxe-tabs.com/file/templates/tabs-vertical-template.html


That's nice…

But I meant is it possible to do it with the AJAX tab control?Hmm

Tab Controls and CssClass Not Working

I have been working with the tab Control for two days with no success at overridding the default styles for the tabs. I have copied the styles from the tabs.css file located in the toolkit, and have modified the hover, active and selected styles that I want to modiy. I have included the new css sheet into my application and included the CssClass reference in the file code. when I run the page or site to debug I get the default images and actions. Could anyone tell me what is wrong. I'm including the source code below:

ASP file

<%@dotnet.itags.org.PageLanguage="VB"AutoEventWireup="true"CodeFile="Default.aspx.vb"Inherits="_Default" %>

<%@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

<linkhref="Tabs.css"rel="stylesheet"type="text/css"/>

</head>

<body>

<formid="form1"runat="server">

<asp:ScriptManagerID="ScriptManager1"runat="server"/>

<div>

<cc1:TabContainerID="TabContainer1"runat="server">

<cc1:TabPanelID="TabPanel1"runat="server"CssClass="ajax__tab_tab1">

<HeaderTemplate>DashBoard</HeaderTemplate>

</cc1:TabPanel>

</cc1:TabContainer>

</div>

</form>

</body>

</html>

Style sheet

/* default layout */

.ajax__tab_default.ajax__tab_header {white-space:nowrap;}

.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}

/* tab1 theme */

.ajax__tab_tab1.ajax__tab_header {font-family:verdana,tahoma,helvetica;font-size:11px;background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-line.gif")%>)repeat-xbottom;}

.ajax__tab_tab1.ajax__tab_outer {padding-right:4px;background:url("Images\green_gradient_3.gif")no-repeatright;height:21px;}

.ajax__tab_tab1.ajax__tab_inner {padding-left:3px;background:url("Images\green_gradient_1.gif")no-repeat;}

.ajax__tab_tab1.ajax__tab_tab {height:13px;padding:4px;margin:0;background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab.gif")%>)repeat-x;}

.ajax__tab_tab1.ajax__tab_hover.ajax__tab_outer {background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-hover-right.gif")%>)no-repeatright;}

.ajax__tab_tab1.ajax__tab_hover.ajax__tab_inner {background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-hover-left.gif")%>)no-repeat;}

.ajax__tab_tab1.ajax__tab_hover.ajax__tab_tab {background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-hover.gif")%>)repeat-x;}

.ajax__tab_tab1.ajax__tab_active.ajax__tab_outer {background:url("Images\green_gradient_4.gif")no-repeatright;}

.ajax__tab_tab1.ajax__tab_active.ajax__tab_inner {background:url("Images\green_gradient_3.gif")no-repeat;}

.ajax__tab_tab1.ajax__tab_active.ajax__tab_tab {background:url("Images\green_gradient_1.gif")repeat-x;}

.ajax__tab_tab1.ajax__tab_body {font-family:verdana,tahoma,helvetica;font-size:10pt;border:1pxsolid#999999;border-top:0;padding:8px;background-color:#ffffff;}

/* scrolling */

.ajax__scroll_horiz {overflow-x:scroll;}

.ajax__scroll_vert {overflow-y:scroll;}

.ajax__scroll_both {overflow:scroll}

.ajax__scroll_auto {overflow:auto}

thank you,

kkof

You should apply the CssClass attribute to the TabContainer control rather than to the TabPanel element.

Kind regards,

sbogus.


Thanks sbogus, placing the CssClass on the TabContainer corrected the issues I was having.

Tab Extender question

Anyone know how to show a busy mouse cursor when one of the tabs is clicked on?You mean for the AJAX to use the UpdateProgress? a busy mouse means the user cannot click anything else, pretty annonying on the web. Best practise in AJAX is to show the UpdateProgress. Use the UpdatePanel with the UpdateProgress and you are in business

Tab Panel

Hi,

This is regarding the tab container control,

Is it possible to show a different page (a different website) in each Tab.

For eg.

there are two tabs Yahoo and Rediff

When Yahoo Tab is clicked the Tab Panel shows the Yahoo website and same way for rediff

Thanks in Advance.

Pab

I suppose it is possible put frames in both tabs and give the targert url to yahoo and rediff


Yes Thanks I got the solution, we can use the <iFrame> tag.

There is one more issue, the Tab is only in half of the webpage, can we increase the size of the Tab Panel, so that it occupies the full web page.

The Frame is reduced to half the page and scroll bar comes. I tried the height and width option by setting them to 100%


For width its fine but for height you have to set height in pixels

Tab Panel displays content of other tab panel

I have a tab container with 4 tabs in it. One that is hidden from certain users. We will refer to this as tab panel 3. When you browse to the page as one of these users the tab control is displayed properly, without tab panel 3. You can select the other tab panels and their content is correct. In tab panel 4 there is a button that causes a post back. When you click on this button the content displayed in tab panel 4 is now the content from tab panel 2 and the content from tab panel 4. If you then select tab panel 1 you see the same behavior, it's content is that of tab panel 2 and tab panel 1. If you select tab panel 2 it seems to reset the tab panels and they all display with the proper content.

any ideas?

ok, the way that the one tab was hidden from certain users was that I left off the headertext for that tab. effetively keeping anyone from getting to it. For some reason this was causing the unexpected behavior.


Correct me from wrong, I guess we're trying to make a tab invisible conditionally using visible property. If yes, instead of using visible property, try to use Enable property to do so. Good luck.


I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

I saw this same behavior when I was dynamically adding tabpanels. 



I fixed this by wrapping the tabpanel content in updatepanels.

Saturday, March 24, 2012

Tab panel problems

Ok, Here's the situation.

I've made a crm with a relations section. on the relation section there are always 4 tabs. but depending on the connection links with other relations there can be added more

so i have to add the tabs programmaticly. this is no problem. but on the first tab there is a detailsview where i edit the relation details. This all works perfectly. I can see the extra tabs and it all looks nice but the problem is when i try to edit the first tab

when i programaticly add the tabs for the relations the edit function on the first tab doesnt work anymore. I also tried only adding one tab. and that doesnt works also. Any ideas?

Error:
Specified argument was out of the range of valid values.
Parameter name: index

Codebehind:
Sub Page_Load(ByVal senderAsObject,ByVal eAs EventArgs)HandlesMe.Load

If (Request.QueryString("action") = 2)Then
FormView1.ChangeMode(FormViewMode.Insert)
tab3.Enabled =False
tab4.Enabled =False
tab5.Enabled =False

Else

If IsPostBackThen

Else

Dim tempTabAs AjaxControlToolkit.TabPanel =New AjaxControlToolkit.TabPanel
tempTab.ID ="tab6"
tempTab.HeaderText ="temptab"

ajaxtab.Controls.Add(tempTab)

EndIf
EndIf

EndSub

System.ArgumentOutOfRangeException was unhandled by user code
Message="Specified argument was out of the range of valid values.\r\nParameter name: index"
Source="System.Web"
ParamName="index"
StackTrace:
at System.Web.UI.ControlCollection.get_Item(Int32 index)
at AjaxControlToolkit.TabPanelCollection.get_Item(Int32 index) in d:\E\AjaxControlToolkit\Release\AjaxControlToolkit\Tabs\TabPanelCollection.cs:line 49
at AjaxControlToolkit.TabContainer.LoadClientState(String clientState) in d:\E\AjaxControlToolkit\Release\AjaxControlToolkit\Tabs\TabContainer.cs:line 353
at AjaxControlToolkit.ScriptControlBase.LoadPostData(String postDataKey, NameValueCollection postCollection) in d:\E\AjaxControlToolkit\Release\AjaxControlToolkit\ExtenderBase\ScriptControlBase.cs:line 303
at AjaxControlToolkit.TabContainer.LoadPostData(String postDataKey, NameValueCollection postCollection) in d:\E\AjaxControlToolkit\Release\AjaxControlToolkit\Tabs\TabContainer.cs:line 444
at AjaxControlToolkit.ScriptControlBase.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) in d:\E\AjaxControlToolkit\Release\AjaxControlToolkit\ExtenderBase\ScriptControlBase.cs:line 414
at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

-------

It doesnt even come past the ispostback on the edit button click


ok got it.. needs to be on page_oninit

Tab Panel problem

I'm trying to programatically change tabs from within javascript without having to go back to the server. After perusing some of the source code I landed on the following simple solution below. The problem I have is that it works in IE but not Firefox and I'm at a loss as to why. I've posted my working (in IE) copy athttp://ajax.jayhawk.net but the source below is complete. (The reason I need to do this is one of my tabs displays a google map and it doesn't draw properly if the tab is not initially visible, so the page loads with the map visible, but during the onload() code it switches to thereal first tab. I saw that some else had this issue but got no responses.)

Also, while I have your attention, I've found it difficult to learn the .NET-munged name of a control on the client side. For example, I have here ID="TabContainer1" and in this trivial example it doesn't change. However, in a more complex application it might be given the name "ctl00_ContentPlaceHolder1_TabContainer1". My "solution" to the problem is to add a hidden <div> at the end that contains nothing but "<%=TabContainer1.ClientID%>" and then use a document.getElementById to fetch the actual name which I can use with $find(). There's got to be a better way to do this, doesn't there?

Thanks in advance for the feedback, and thanks for some great tools!
-bp

<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="true" CodeFile="default.aspx.vb" Inherits="_Default" %>

<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Tabs Test Page</title>
<script type="text/javascript">
var tab = 0;
function changetab()
{
var strContainer = document.getElementById("divTabContainer1").innerText;
var container = $find(strContainer);

container.set_activeTabIndex( ++tab > 2 ? tab = 0 : tab );
}
</script>
</head>
<body>
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</cc1:ToolkitScriptManager>
<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Height="142px"
Width="269px">
<cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="TabPanel1">
<ContentTemplate>
This is tab #1
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="TabPanel2">
<ContentTemplate>
Now you're looking at tab #2
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="TabPanel3">
<ContentTemplate>
And, finally, it's tab #3!
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer><br />
<input type="button" onclick="javascript:changetab();" value="Click Me!" />
</form>
<div id="divTabContainer1" style="visibility: hidden;"><%=TabContainer1.ClientID%></div>
</body>
</html>

Hi,
I guess the reason is that innerText isn't a valid property for div element when work in Firefox. If you use a input element here, it works fine.
For instance:

var tab = 0;
function changetab()
{
var strContainer = document.getElementById("ipt").value;
var container = $find(strContainer);

container.set_activeTabIndex( ++tab > 2 ? tab = 0 : tab );
}

<input type="hidden" id="ipt" value=<%=TabContainer1.ClientID%> /
As a matter of fact, you don't need to use a element to hold its id, please try this:

</form>
<script type="text/javascript">
var tab = 0;
function changetab()
{
var container = $find("<%=TabContainer1.ClientID%>");

container.set_activeTabIndex( ++tab > 2 ? tab = 0 : tab );
}
</script>
</body>
</html>

Hope this helps.

Tab Panels inside of a repeater?

I'm trying to create a dynamic amount of tabs and cannot place tab panels inside, is their a suggested alternative?

I just need tab like functionality.

Thanks alot!

-Ryan

Hi Ryan,

I'm not sure how are you trying to implement it with Repeater, but you can create TabPanel dynamically.

For instance:

AjaxControlToolkit.TabPanel tbpanel = new AjaxControlToolkit.TabPanel();
tbpanel.HeaderText = "Tab 01";
tbpanel.Controls.Add(new TextBox());
Label lb = new Label();
lb.Text = "Content";
tbpanel.Controls.Add(lb);
TabContainer1.Tabs.Add(tbpanel);

Hope this helps.


Thanks for the reply, that seems useful but I'm still a little confused how I should use it, basically this is what I need.

A Tab Container is created, inside is a repeater which, with each iteration, creates a tab panel and populates it.

So how would I add the stuff inside the panels (the stuff I've written in the aspx page)
Do I still databind?

Just confused where/how I should use that,

thanks!


So you want to populate the TabPanel dynamically? And the contents to be populated are different aspx pages?

TabPanel can't be used as a container for another page, unless wrapping a iframe inside it.

I would recommend you create UserControl(.ascx) for different content, and load it into the TabContainer.

For instance:

AjaxControlToolkit.TabPanel tbpanel = new AjaxControlToolkit.TabPanel();
tbpanel.HeaderText = "Tab 01";

if( .............. ){
Control c = this.LoadControl("relative path to the UserControl")
tbpanel.Controls.Add(c);
}
TabContainer1.Tabs.Add(tbpanel);

Tabcontainer - Setting focus on tabs after postback

Is it possible to set the focus to a specific tab after postback or in event handlers.

Any help with this problem will be greatly appreciated.

me.TabContainer1.Tabs(index).Focus, there is an ActiveTabChanged event in the code behind as well.

Is that what your looking for? Also a new video has been posted on the tabContainer in the video's section of this site.

Burl

TabContainer - ActiveTabIndex not matching ActiveTab

I'm not sure if anyone has seen this, but I am experiencing the following:

I have a tab container when several (8) tabs.

On page load, I dynamically set the "Visible" property of particular tabpanels based on database values (security schema for what a user can see). Along with setting the visibility, I also set HeaderText = "" so that nothing renders at all.

The problem I am having is that if I set the first tabpanel (index=0) to not be visible, then the TabContainer seems to incorrectly associate ActiveTabIndex and ActiveTab. For instance, the container will correctly identify that the ActiveTabIndex = 2 (third tab), but the ActiveTab is referencing the second tab (incorrectly). It is as if setting a tabpanel to be invisible causes a mismatch between ActiveTab and ActiveTabIndex.

Has anyone else experienced this? It is not very hard to replicate, I am wondering if this is a bug with this control?!?!?!?

Thanks, in advance!

-Jim

Can someone replicate this issue? It should only take a few minutes...

I need to know if I am doing something wrong or if it is a bug in the control...


Hi,

I think that when a tab is set to visible="false", it does not get rendered to client. So, the next tab does get an index of 0. Sounds logical to me like that..

Maybe you could use Tabcontainer.ActiveTab = [id of tab] instead of index?