Load User Control

2 posts, 1 answers
  1. Michael
    Michael avatar
    18 posts
    Member since:
    Jun 2009

    Posted 08 Mar 2010 Link to this post


    I have an issue in regards to loading a user control.

    I have a radtabstrip inside a header user control and each tab dynamically loads a user control into a content panel on the main page. The first tab loads a user control and inside that it has a button that loads another user control and replaces the current user control *which is itself* inside the content panel.

    This is working fine as expected.

    The issue I have is when I want to reload the orginial user control that the first tab loads it wont let me because I have already clicked  the first tab, the tabClick event wont fire a second time. So therefore I can't reload my first usercontrol back onto the page.

    Is there anyway to force the TabClick to fire again when I click onto it a second time?

  2. Answer
    Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 11 Mar 2010 Link to this post

    Hi Michael,

    Normally, RadTabStrip does not postback when you click on the selected tab. To override this behavior you need to modify one of the internal javascript functions of the control. Here is how - add the following javascript code after the TabStrip's declaration:

    <script type="text/javascript">
    Telerik.Web.UI.RadTab.prototype.select = function (e)
        var parent = this.get_parent();
        if (!parent)
            this._cachedSelected = true;
            return true;
        var shouldNavigate = this._shouldNavigate();
        var selectedTab = parent.get_selectedTab();
        var tabStrip = this.get_tabStrip();
    //these lines are commented so the tabstrip postbacks even if you click on the selected tab
    //      if (!shouldNavigate && selectedTab == this && !tabStrip.get_clickSelectedTab())
    //          return false;
        if (tabStrip._raiseCancelEvent("tabSelecting", this, e))
            return false;
        var suppressVisualUpdate = this._shouldPostBack() || (shouldNavigate && (!this.get_target() || this.get_target() == "_self"));
        if (!e)
            suppressVisualUpdate = false;
        if (selectedTab && selectedTab != this)
            selectedTab.unselect(suppressVisualUpdate, e);
        if (!suppressVisualUpdate)
            if (this._scroller)
                tabStrip._scrollInitInProgress = true;
                tabStrip._scrollInitInProgress = false;
            if (tabStrip._reorderTabsOnSelect)
                Telerik.Web.UI.RadTabStrip._reorderTabs(parent.get_childListElement(), this.get_element());
        if (tabStrip.get_multiPage())
        tabStrip._raiseEvent("tabSelected", this, e);
        return true;
    Hope this helps.

    Kind regards,
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft R3 2016 release webinar banner
Back to Top