TabContainer使用过程中混肴滚动位置问题

>>Issue:

I have a 3 tab panels in a tab container in the middle of the page. The problem is that when the page loads the first tab panel gets focus and the page is scrolled to that position.

Looking at the latest AJAX Souce code from December, I noticed that the _app_onload function forces the focus to the active tab.  I believe this is occuring upon every postback.  Before I muck around with the source, I wanted to see if there was a reason for this.

Since posting this I commente out the "activeTab._setFocus(activeTab);" line.  It works in multiple browsers; just not IE8, which is what my organization is current stuck on.  Still looking for a solution to the Scroll Position.

>>Solution:

<ajax:ToolkitScriptManager ID="scriptmanager1" runat="server"></ajax:ToolkitScriptManager>
    <script type="text/javascript">
        Sys.Extended.UI.TabContainer.prototype._app_onload = function (sender, e) {
            if (this._cachedActiveTabIndex != -1) {
                this.set_activeTabIndex(this._cachedActiveTabIndex);
                this._cachedActiveTabIndex = -1;

                var activeTab = this.get_tabs()[this._activeTabIndex];
                if (activeTab) {
                    activeTab._wasLoaded = true;
                    //activeTab._setFocus(activeTab);     // the only change made to this prototype
                }
            }
            this._loaded = true;
        }
   </script>

please refer to the links for details:

Ajax Control Toolkit tab panel control gets the focus automatically and the page scrolls to that control on load

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

TabContainer throws exception in user control with Nov release

http://ajaxcontroltoolkit.codeplex.com/workitem/27053

 

 

转载于:https://www.cnblogs.com/happy-Chen/p/3583961.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值