Showing posts with label tabcontainers. Show all posts
Showing posts with label tabcontainers. Show all posts

Saturday, March 24, 2012

TabContainer and Firefox 2.0.0.2 Postback Issue

After updating Firefox to 2.0.0.2 yesterday, all my TabContainers have stopped functioning. Whenever a postback occurs, the entire TabContainer disappears and I get a javascript errorError: Sys.InvalidOperationException: Component 'ctl00_ContentPlaceHolder1_TabSet1' was not found.

Tested in IE 7 and they continue to work, and they were working fine until updating to the new version of Firefox.

It appears to do it only when the tabcontainer is inside an updatepanel, not when the updatepanel is inside the tabcontainer

This has become a problem for me - I had to remove all update panels that I had associated with my TabContainer control. Here is a little more info on the problem:

Repro:
In FireFox 2.0.0.2 only...
See below for .aspx file to test against. In short, put a TabContainer inside of an update panel, cause a post back to occur.

Expected:
Postback should occur normally, tab container is updated inline.

Actual:
Javascript exception is thrown, Error.invalidOperation() , in file (I believe) MicrosoftAjax.js, function function Sys$Component$_setReferences(component, references) .

Notes:
* http://www.mozilla.com/en-US/firefox/2.0.0.2/releasenotes/
* Stepping through the code actually seems fine - but I've not done much debugging in this particular portion of Ajax.


<%-- Sample, broken TabContainer inside of Update Panel --%>

<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><html><body><form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="Server" /> <asp:UpdatePanel runat="server" ID="updatePanelForTestControl" UpdateMode="Conditional"> <ContentTemplate> <ajaxToolkit:TabContainer runat="server" ID="Tabs" ActiveTabIndex="1"> <ajaxToolkit:TabPanel runat="Server" ID="Panel1" HeaderText="Tab 01"> <ContentTemplate> First tab panel </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel runat="Server" ID="Panel2" HeaderText="Tab 02" > <ContentTemplate> Second tab panel <asp:Button ID="Button1" runat="Server" Text="Post Back" /> </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> </ContentTemplate> </asp:UpdatePanel></form></body></html>

I'm not sure who owns the responsibility here - if it's an update panel issue, or a TabContainer issue. As such, I posted an "issue" on the AjaxControlToolkit forums:

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

Regards,
Kevin


Investigation is ongoing. What appears to be the case is that the Firefox 2.0.0.2 update changed the ordering of two browser events UpdatePanel uses in such a way as to break certain aspects of ASP.NET AJAX. Microsoft folks are looking into the issue now and should update this thread (or maybe post a new, sticky one) once they know more.


that is casewe are working with the firefox team actively to figure out the best approach to address this issue and we will update this thread as soon as we know more about it.

Just to expand on this, my customers have told me of problems with Telerik RadAJAX and MagicAJAX when FireFox 2.0.0.2 was installed.

Telerik has already published a fix:http://www.telerik.com/community/forums/thread/b311D-tccek.aspx

I have yet to validate the MagicAJAX problem.

From my perspective as a custom controls developer, it sounds like FireFox did a bad thing because they've broken a lot of AJAX-based sites.


FYI, the ASP.NET AJAX team will be tracking this issue here:http://forums.asp.net/thread/1600941.aspx

Please check there for up-to-date information.


It seems that in FireFox 2.0.0.2 dynamically loaded javascript files (much needed by all AJAX frameworks) are handled in a completely different fashion, whici as far as I can see is causing major problems fror all AJAX frameworks. The guys from telerik are ready with the update and created a hotfix (Q4 SP2) - so if you are using telerik r.a.d.ajax - just upgrade. I'm sure Microsoft guys will respond as quickly as possible as well (and I am well aware that for company like Microsoft and for product like ASP.NET AJAX this will take some time).

Here is the bug I believe is related (since I've seen most AJAX libraries use the innerHTML approach for dynamically loading javascript under the hood).

https://bugzilla.mozilla.org/show_bug.cgi?id=371628

Wednesday, March 21, 2012

TabContainer doesnt persist tab selection between postbacks

Hi,

I'm using a couple of TabContainers on my web form. The main TabContainer hosts seven TabPanels, each of which hosts a different FormView control.

According to the Tab documentation, "the most recent tab should remain selected after a postback." However, whenever I change the mode on a FormView (e.g. changing to Edit a record), a postback occurs and a the first tab is selected again.

I tried setting the TabContainer's EnableViewState="True", but that didn't help.

What do I need to do to keep the same tab selected between postbacks?

Thanks,

Mark

Anyone else seeing this problem? Any idea how to keep the tab selected between postbacks?

Thanks,

Mark


Hi Mark,

According to my test, the active index is persisted between postbacks.

If it doesn't for you, please try the following workaround.

1. Add a hidden field on the form

2. On the client side active index changed event, save current index into the hidden field

3. On postback, set the activeIndex of the tabContainer to the value in hidden field( on Server Side )

Or set it via javascript in client side pageLoad event.

Hope this helps.


Thank you Raymond. Sorry for the late reply; I have been distracted with other tasks. I'll try this when I get back to working on the UI.

Mark