This is a migrated thread and some comments may be shown as answers.

Go To Tab without Postback

5 Answers 267 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Lasly
Top achievements
Rank 1
Lasly asked on 21 Feb 2012, 04:28 PM
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

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Feb 2012, 06:57 AM
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.
0
Lasly
Top achievements
Rank 1
answered on 04 Jul 2012, 08:49 AM
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.
0
Princy
Top achievements
Rank 2
answered on 04 Jul 2012, 01:02 PM
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.
0
Lasly
Top achievements
Rank 1
answered on 04 Jul 2012, 01:37 PM

 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.
0
Dimitar Terziev
Telerik team
answered on 09 Jul 2012, 08:50 AM
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.
Tags
TabStrip
Asked by
Lasly
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Lasly
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or