Can someone post all the code in one message that works? I would greatly appreciate it! Thanks!!![:D]
spafa9
-------------
Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
The following is compiled from two different members in this thread:
We agree that the enabled = false actually hides the tabpanel on the client side.
The functionality you require can be done with some customization of the AjaxControlToolkit.
The tabs.js file needs editing to make this happen. the usde of the "disabled" keyword is used in the javascript in the show and hide functions
Then the AjaxControlToolkit recompiled to update the AjaxControlsToolkit.dll since the tabs.js file is an embedded resource.
you need to add some if blocks around some existing code as shown below
Change 1: Change the set_activetabindex function
set_activeTabIndex : function(value) {
if (!this.get_isInitialized()) {
this._cachedActiveTabIndex = value;
} else {
if (value < -1 || value >= this.get_tabs().length) {
throw Error.argumentOutOfRange("value");
}
// only if new tab is enabled then make active
if (this.get_tabs()[value]._enabled) {
if (this._activeTabIndex != -1) {
this.get_tabs()[this._activeTabIndex]._set_active(false);
}
this._activeTabIndex = value;
if (this._activeTabIndex != -1) {
this.get_tabs()[this._activeTabIndex]._set_active(true);
}
if (this._loaded) {
this.raiseActiveTabChanged();
}
this.raisePropertyChanged("activeTabIndex");
}
// no else
}
},
Change 2: Edit the show, hide, activate and deactivate functions as shown below.
_activate : function() {
if (this._enabled) {
var elt = this.get_element();
Sys.UI.DomElement.setVisible(elt, true);
Sys.UI.DomElement.addCssClass(this._tab, "ajax__tab_active");
this.populate();
this._show();
}
},
_deactivate : function() {
if (this._enabled) {
// original lines below
var elt = this.get_element();
Sys.UI.DomElement.setVisible(elt, false);
}
Sys.UI.DomElement.removeCssClass(this._tab, "ajax__tab_active");
},
_show : function() {
if (this._enabled) {
// original line
this._tab.style.display = '';
}
else
{
this._tab.disabled = true;
}
},
_hide : function() {
if (this._enabled){
this._tab.style.display = 'none';
}
else
{
this._tab.disabled = true;
}
// original lines below
if (this._get_active()) {
var next = this._owner.getNearestTab(false);
if (!!next) {
this._owner.set_activeTab(next);
}
}
this._deactivate();
},
Recompile and use as normal
Use the .enabled property programatically to disable and enable tabs as you expected to,
Hope this helps
Daniel F.
Hi,
one small addition: If you want to user 'tabs.get_tabs()[1].set_enabled( true );' on the clientside to enable the tab again, you have to insert the following to additional lines (this._tab.disabled = false; ). If these lines are not present, the tab will
be enabled again, but the style still keeps disabled (greyed).
THank you for consolidating the posts. I appreciate it. I put in all the code as described above. I recompile it and run it. When I go to the tabs section my tabs are not showing up at all? Did you have the same issue. I think I am doing something wrong.
spafa
-------------
Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
I didn't have any problems with the tabs not showing up at all... I DID have an interesting issue tho....
Here's from one of my prior posts on the topic:
I have added the proper update code to Tabs.js like posted in this thread, and closed VS 2005 and reopened it. (Did this suffice to 'rebuild' the
.dll/Tabs.js?)
When I use the code: "TabContainer1.ActiveTab.Enabled =
False" , the tab that I called actually disappears.
When I use the code: "TabContainer1.Enabled = False" , all of the tabs are greyed out, but they still work/are clickable.
<ajaxToolkit:TabPanel
ID="TabPanel3"
runat="server"
Enabled="false">
the headerTemplate of the TabPanel instead of getting disabled gets invisible? And vice-versa...
Then if you look at the source code the contentTemplate, and you set the enabled property to false of the TabPanel, the contentTemplate,
doesn't get rendered... If you set the visible property to false, the content gets rendered?
TKS,
C.C.
Oh another thing... I've instaled the latest ajax toolkit version for visual studio 2005, the 1.0.11111.9 I guess. What happens is that I have the pretty icons for all the controls, but I haven't the one for the TabPanels...? Is it just me?
BGriffin_TPA
Member
489 Points
311 Posts
Re: How to set a Tab in a Tabcontainer to disabled (but visible)
Jan 14, 2008 02:49 PM|LINK
When someone fixes this, can you confirm that it will bein the next regular
toolkit update?... [:|] I can wait till then..but would like to know it now.
Thanks..[cool]
FZero
Member
21 Points
32 Posts
Re: How to set a Tab in a Tabcontainer to disabled (but visible)
Jan 14, 2008 02:52 PM|LINK
Has anybody gotten this workaround to function correctly?
www.fightingzero.com
spafa9
Member
126 Points
112 Posts
Re: How to set a Tab in a Tabcontainer to disabled (but visible)
Jan 14, 2008 02:54 PM|LINK
Can someone post all the code in one message that works? I would greatly appreciate it! Thanks!!![:D]
spafa9
Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
FZero
Member
21 Points
32 Posts
Re: How to set a Tab in a Tabcontainer to disabled (but visible)
Jan 14, 2008 03:04 PM|LINK
The following is compiled from two different members in this thread:
We agree that the enabled = false actually hides the tabpanel on the client side.
The functionality you require can be done with some customization of the AjaxControlToolkit.
The tabs.js file needs editing to make this happen. the usde of the "disabled" keyword is used in the javascript in the show and hide functions
Then the AjaxControlToolkit recompiled to update the AjaxControlsToolkit.dll since the tabs.js file is an embedded resource.
you need to add some if blocks around some existing code as shown below
Change 1: Change the set_activetabindex function
set_activeTabIndex : function(value) {
if (!this.get_isInitialized()) {
this._cachedActiveTabIndex = value;
} else {
if (value < -1 || value >= this.get_tabs().length) {
throw Error.argumentOutOfRange("value");
}
// only if new tab is enabled then make active
if (this.get_tabs()[value]._enabled) {
if (this._activeTabIndex != -1) {
this.get_tabs()[this._activeTabIndex]._set_active(false);
}
this._activeTabIndex = value;
if (this._activeTabIndex != -1) {
this.get_tabs()[this._activeTabIndex]._set_active(true);
}
if (this._loaded) {
this.raiseActiveTabChanged();
}
this.raisePropertyChanged("activeTabIndex");
}
// no else
}
},
Change 2: Edit the show, hide, activate and deactivate functions as shown below.
_activate : function() {
if (this._enabled) {
var elt = this.get_element();
Sys.UI.DomElement.setVisible(elt, true);
Sys.UI.DomElement.addCssClass(this._tab, "ajax__tab_active");
this.populate();
this._show();
}
},
_deactivate : function() {
if (this._enabled) {
// original lines below
var elt = this.get_element();
Sys.UI.DomElement.setVisible(elt, false);
}
Sys.UI.DomElement.removeCssClass(this._tab, "ajax__tab_active");
},
_show : function() {
if (this._enabled) {
// original line
this._tab.style.display = '';
}
else
{
this._tab.disabled = true;
}
},
_hide : function() {
if (this._enabled){
this._tab.style.display = 'none';
}
else
{
this._tab.disabled = true;
}
// original lines below
if (this._get_active()) {
var next = this._owner.getNearestTab(false);
if (!!next) {
this._owner.set_activeTab(next);
}
}
this._deactivate();
},
Recompile and use as normal
Use the .enabled property programatically to disable and enable tabs as you expected to,
Hope this helps
Daniel F.
Hi,
one small addition: If you want to user 'tabs.get_tabs()[1].set_enabled( true );' on the clientside to enable the tab again, you have to insert the following to additional lines (this._tab.disabled = false; ). If these lines are not present, the tab will be enabled again, but the style still keeps disabled (greyed).
_show : function()
{
if (this._enabled)
{ // original line
this._tab.style.display = '';
this._tab.disabled = false;
}
else
{
this._tab.disabled = true;
}
},
_hide : function()
{
if (this._enabled)
{
this._tab.style.display = 'none';
this._tab.disabled = false;
}
else
{
this._tab.disabled = true;
} // original lines below
if (this._get_active())
{
var next = this._owner.getNearestTab(false);
if (!!next)
{
this._owner.set_activeTab(next);
}
}
this._deactivate();
},
HTH
www.fightingzero.com
spafa9
Member
126 Points
112 Posts
Re: How to set a Tab in a Tabcontainer to disabled (but visible)
Jan 14, 2008 03:56 PM|LINK
THank you for consolidating the posts. I appreciate it. I put in all the code as described above. I recompile it and run it. When I go to the tabs section my tabs are not showing up at all? Did you have the same issue. I think I am doing something wrong.
spafa
Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
FZero
Member
21 Points
32 Posts
Re: How to set a Tab in a Tabcontainer to disabled (but visible)
Jan 14, 2008 04:04 PM|LINK
No prob....
:)
I didn't have any problems with the tabs not showing up at all... I DID have an interesting issue tho....
Here's from one of my prior posts on the topic:
I have added the proper update code to Tabs.js like posted in this thread, and closed VS 2005 and reopened it. (Did this suffice to 'rebuild' the .dll/Tabs.js? )
When I use the code: "TabContainer1.ActiveTab.Enabled = False" , the tab that I called actually disappears.
When I use the code: "TabContainer1.Enabled = False" , all of the tabs are greyed out, but they still work/are clickable.
www.fightingzero.com
ccharneca
Member
63 Points
48 Posts
Re: How to set a Tab in a Tabcontainer to disabled (but visible)
Jan 30, 2008 03:44 PM|LINK
Hi
<ajaxToolkit:TabPanel ID="TabPanel3" runat="server" Enabled="false"> the headerTemplate of the TabPanel instead of getting disabled gets invisible? And vice-versa...Has anyone noticed that when doing this:
Then if you look at the source code the contentTemplate, and you set the enabled property to false of the TabPanel, the contentTemplate, doesn't get rendered... If you set the visible property to false, the content gets rendered?
TKS,
C.C.
Oh another thing... I've instaled the latest ajax toolkit version for visual studio 2005, the 1.0.11111.9 I guess. What happens is that I have the pretty icons for all the controls, but I haven't the one for the TabPanels...? Is it just me?
TabPanel Tabs TabContainer "Ajax Control Toolkit"
megmoc
Member
3 Points
10 Posts
Re: How to set a Tab in a Tabcontainer to disabled (but visible)
Apr 08, 2008 02:07 PM|LINK
Has any one got an update on this please?
BGriffin_TPA
Member
489 Points
311 Posts
Re: How to set a Tab in a Tabcontainer to disabled (but visible)
Apr 09, 2008 06:00 PM|LINK
NOPE..still doesn't work properly in response to the .enabled property..[:'(]
I just checked using 1.0.20229 (for .NET 2.5)..still broken..but at least the
rendering problem in Firefox is fixed..kudos to whoever did that..[Yes]
I'm sure somebody knows of this and has it on their agenda.
Happy to help...[cool]
m3tano
Member
2 Points
4 Posts
Re: How to set a Tab in a Tabcontainer to disabled (but visible)
Apr 15, 2008 01:36 PM|LINK
Hello Guys!
Has someone figured this out yet? [cool] I need to emulate this behavior badly! And if someone's got the trick, could you please post it on VB code?
Thank you!
-Snoop Dogg-