Go To Tab without Postback

6 posts, 0 answers
  1. Lasly
    Lasly avatar
    115 posts
    Member since:
    Nov 2009

    Posted 21 Feb 2012 Link to this post

    Hy,
    I would like to move between tabs by clicking a button, but without sync-postback.
    (I would like to use Async-postback)
    is it possible?


    thanks
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 22 Feb 2012 Link to this post

    Hello,

    Try the following code.
    JS:
    function OnClientClick()
     {
      var tabstrip1 = $find("<%=RadTabStrip1.ClientID %>");
      selectdindex = tabstrip1.get_selectedIndexes();
      selectdindex = ++selectdindex;
      if (selectdindx < tabstrip1.get_tabs().get_count())
       {
         tabstrip1.set_selectedIndex(selectdindex);
       }
      else
       {
         selectdindex = 0;
         tabstrip1.set_selectedIndex(selectdindex);
       }
     }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lasly
    Lasly avatar
    115 posts
    Member since:
    Nov 2009

    Posted 04 Jul 2012 Link to this post

    Hello,
    Thanks but unfortunately this answer was not helpful for me.
    After months I find myself with the same unsolved problem.
    I need to solve this problem in Async Postback.

    I have a TabStrip/MultiPage-based web application.
    I have a RadTabStrip and RadMultiPage which loads user controls for each tab. 
     I need to be able to navigate through the tabs from one of my user controls that are loaded into the PageViews in the RadMultiPage.

    inside the event grid_ItemCommand
    I select the tab of the rad radtabstrip and pageviews multipage where I want to move.
    If I am in full postback works, but if I'm in async-postback, it does not work!
    My problem is equal at  http://www.telerik.com/community/forums/aspnet-ajax/tabstrip/change-tab-programmatically.aspx.
    but in  Asynchronous Postback.
    Help me please.
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Jul 2012 Link to this post

    Hi Lasly,

    Here is the full code that I tried and which worked as expected at my end.

    ASPX:
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" AutoPostBack="false" SelectedIndex="0" MultiPageID="RadMultiPage1">
       <Tabs>
         <telerik:RadTab Text="AAA" PageViewID="RadPageView0" Selected="true" PostBack="false">
         </telerik:RadTab>
         <telerik:RadTab Text="BBB" PageViewID="RadPageView1" PostBack="false">
         </telerik:RadTab>
         <telerik:RadTab Text="CCC" PageViewID="RadPageView2" PostBack="false">
         </telerik:RadTab>
         <telerik:RadTab Text="DDD" PageViewID="RadPageView3" PostBack="false">
         </telerik:RadTab>
       </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">
       <telerik:RadPageView ID="RadPageView0" runat="server">
         <uc1:ExchangeRates ID="ExchangeRates1" runat="server" />
       </telerik:RadPageView>
       <telerik:RadPageView ID="RadPageView1" runat="server">
         <uc2:Horoscopes ID="Horoscopes1" runat="server" />
       </telerik:RadPageView>
       <telerik:RadPageView ID="RadPageView2" runat="server">
         <uc3:News ID="News1" runat="server" />
       </telerik:RadPageView>
       <telerik:RadPageView ID="RadPageView3" runat="server">
         <uc1:ExchangeRates ID="ExchangeRates2" runat="server" />
       </telerik:RadPageView>
    </telerik:RadMultiPage>
    <asp:Button ID="Button1" runat="server" Text="Button1" OnClientClick="OnClientClick(); return false;" />

    JS:
    <script type="text/javascript">
        function OnClientClick() {
            var tabstrip1 = $find("<%=RadTabStrip1.ClientID %>");
            var selectdindex = tabstrip1.get_selectedIndexes();
            selectdindex = ++selectdindex;
            if (selectdindex < tabstrip1.get_tabs().get_count()) {
                tabstrip1.set_selectedIndex(selectdindex);
            }
            else {
                selectdindex = 0;
                tabstrip1.set_selectedIndex(selectdindex);
            }
        }
    </script>

    Please provide your full code if it doesn't helps.

    Thanks,
    Princy.
  6. Lasly
    Lasly avatar
    115 posts
    Member since:
    Nov 2009

    Posted 04 Jul 2012 Link to this post

     thanks for the reply,  maybe  I can't seem  to explain my problem. 
    I have to do it in server  side in the event grid_ItemCommand  in asynchronous postback.

     I can not replicate my scenario because it is very complex.
    My tab are dinamically added to the radTabstrip
     follow the important parts:

    1) in  ascx.cs

    protected void grdRicercaContInq_ItemCommand(object sender, GridCommandEventArgs e)
         {
            
             switch (e.CommandName.ToLower())
             {                     
                      
            case "entrainq":
                     //... do somethings   for example I can enabled tab
                     // select tab  ( radTabStrip is my stripControl in masterPage)
                     ((GLNMaster)(this.Page.Master)).radTabStrip.FindTabByValue(GLNMaster.GLtab.ContiInquilini.TabID()).Selected = true;
                     //select pageview  ,  (radMultiPage is my multipage control in mastePage)
                     ((GLNMaster)(this.Page.Master)).radMultiPage.PageViews[1].Selected = true;
                     break;

    2) in ascx  update the radTab., "radTabGLGestione"  is my ratTabstrip Control.
    <telerik:RadAjaxManagerProxy ID="ajaxProxyManagerCin" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="grdRicercaContInq">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="grdRicercaContInq" LoadingPanelID="pnlLoading" /> 
                      
                    <telerik:AjaxUpdatedControl ControlID="grdContInq" />
                       <telerik:AjaxUpdatedControl ControlID="radTabGLGestione" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>

    If I try update Radmultipage throws exception object undefined.


    Without RadAjaxManagerProxy , so with a full postback, it works, in async-postback the tab  updated   but the assosciated PageView is not shown.
  7. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 09 Jul 2012 Link to this post

    Hi Lasly,

    In order to identify the case of the error being received, please open a support ticket and provide a runnable sample which we could debug locally.

    Kind regards,
    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017