TabStrip Tab Click - Exclude from Ajax

4 posts, 0 answers
  1. Kurt Wondra
    Kurt Wondra avatar
    7 posts
    Member since:
    Oct 2009

    Posted 04 Feb 2010 Link to this post

    Hello,

    I have a webpage with a radTabStrip in it which is fully wrapped by an ajax panel.  What I want is for the whole tab strip to do its partial postbacks using that ajax except for the last tab.  If the user clicks on that specific tab, I do not want the ajax to kick in, rather I want to do a full postback and then load that last time.

    Using the article found here (http://www.telerik.com/help/aspnet-ajax/ajxexclude.html) I was able to make a button that is displayed on my second last tab to be excluded from the ajax (that button is a "Next" button which correctly calls for a full postback and then the final tab and its info is loaded).  I tried applying the same principle to the tab itself when it gets clicked, but when I debug I can clearly see that the ajax panel kicks in because I can then see the loading panel for a split second and then when the page is done processing, I am looking at the same thing I was before. Neither the tab or the content changes.

    Here is the code I used to try to have my tab menu item excluded from the ajax panel:
    tabScheduleQueryWizard.Tabs[13].Attributes.Add("onclick", string.Format("realPostBack(\"{0}\", \"\"); return false;", tabScheduleQueryWizard.Tabs[13].UniqueID));

    And this is the code I have for the previously described button which works as desired:
    btnNextCriteria.Attributes.Add("onclick", string.Format("realPostBack(\"{0}\", \"\"); return false;", btnNextCriteria.UniqueID));

    Any ideas?

  2. Yana
    Admin
    Yana avatar
    5023 posts

    Posted 08 Feb 2010 Link to this post

    Hello Kurt,

    You should subscribe to OnClientTabSelecting event of RadTabStrip and in its handler cancel the event if the last tab is clicked (using set_cancel(true) method) and add the postback functionality as explained in the help article.

    All the best,
    Yana
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. Kurt Wondra
    Kurt Wondra avatar
    7 posts
    Member since:
    Oct 2009

    Posted 08 Feb 2010 Link to this post

    Yana,

    I've tried what you've suggested but I just cannot seem to get it correct.  From what I'm seeing, that set_cancel(true) is turning off the tab strips OnTabClicked method and by turning that off, the ajax is turned off.  However, I need that OnTabClicked event to fire on the server but for it to happen in a full postbast request, not a ajax request.  Also, I could not get any desired results with the OnClientTabSelecting method.  After I employed the OnClientTabSelected method I was at least able to have my page show me the content of the final tab that I mentioned previously.

    Could you please supply me with some source code of a working example of this that I may use as a tool to compare to?

    Thanks.
  4. Yana
    Admin
    Yana avatar
    5023 posts

    Posted 11 Feb 2010 Link to this post

    Hello Kurt,

    You are right, I'm sorry for my confusion.

    Here is another approach to achieve this - subscribe again to OnClientTabSelecting event and set EnableAjax property of the tabstrip according to the selected tab:

    function tabSelecting(sender, args) {
        var ajaxManager = $find("<%= ajaxPanel1.ClientID %>");
       
        if (args.get_tab().get_isLast())
            ajaxManager.set_enableAJAX(false);
        else
            ajaxManager.set_enableAJAX(true); 
         
    }


    Regards,
    Yana
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Back to Top