Showing posts with label clientstate. Show all posts
Showing posts with label clientstate. Show all posts

Wednesday, March 21, 2012

TabContainer ClientState problem

I'm quite new in this AJAX stuff, so if you have any better solution, please post it.

Today I decided to use Tabs from ASP.NET AJAX Control Toolkit and found a stupid problem with them: The ClientState doesn't get updated when a post-pack is fired from drop-down list (OnIndexChanged event + AutoPostBack) or from custom control (I have server control that inherits from Button, but renders in a different way). It seems that the control toolkit framework doesn't process these post-backs as it should and the saveClientState of AjaxControlToolkit.TabContainer isn't called (basicaly it means, that all other controls that are derived from AjaxControlToolkit.ControlBase have this problem - correct me, if I'm wrong).

What I did was, that I added this function to the TabContainer class (in Tabs.js):

set_ClientState : function(value) {
var input = this.get_clientStateField();
if (input) {
input.value = value;
}
},

and

added this line:

this.set_ClientState(this.saveClientState());

before:

 if (this._loaded) {
this.raiseActiveTabChanged();
}
this.raisePropertyChanged("activeTabIndex");

in set_activeTabIndex function of AjaxControlToolkit.TabContainer.

Hope it helps someone.

I'm having the same problem. I'm trying to implement your solution, but I still get the same 'Specified argument was out of the range of valid values.Parameter name: index' error. I think it's because I'm not actually referencing the modifiedTabs.js file from my code.

I've made the correction that you specified in AJAX Control Toolkit\AjaxControlToolkit\Tabs.js and rebuilt the AjaxControlToolkit solution. I made sure that the new AjaxControlToolkit.dll is in AJAX Control Toolkit\AjaxControlToolkit\bin\Debug, AJAX Control Toolkit\SampleWebSite\Bin, AJAX Control Toolkit\AjaxControlExtender, and my web site's App_Data, which are all of the places that it existed. I'm not sure which, if any of those locations my app reads from. I tested removing all of them, but my app ran and the TabContainer/TabPanels were created, so I'm not sure it uses the dll in any of those locations.

Can you give me a pointer on how to get this done?


Hi bjs339 have you read this post?

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

I think the trick for you is to use the TabContainer event OnInit