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

Tab Wizard (client-side) Documentation - Javascript Code is missing tags

1 Answer 63 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Odin
Top achievements
Rank 1
Odin asked on 24 Nov 2011, 12:29 AM
Hi,
Tab Wizard (client-side)  Documentation - Javascript Code is missing tags.
http://www.telerik.com/help/aspnet-ajax/tabstrip-tab-wizard.html


Here is the code on the page.
<form id="form1" runat="server">
   <script type="text/javascript">
   function onNavigate(isMoveNext)
   
       var tabs = $find('<%= rtbstMain.ClientID %>');
       var totalNumOfTabs = tabs.get_tabs().get_count();
       if(totalNumOfTabs > 0) {
           var newTabIndex;
           var currentTabIndex = tabs.get_selectedIndex();
 
           if(isMoveNext){
               if(currentTabIndex + 1 == totalNumOfTabs) {
                   newTabIndex = 0;
               }
               else {
                   newTabIndex = currentTabIndex + 1;
               }
           }
           else{
               if(currentTabIndex - 1 < 0) {
                   newTabIndex=totalNumOfTabs - 1else {
                   newTabIndex=currentTabIndex - 1tabs.set_selectedIndex(newTabIndexscript>
   <asp:ScriptManager ID="smPageScriptManager" runat="server" />
   <telerik:RadTabStrip ID="rtbstMain" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="0">
       <Tabs>
           <telerik:RadTab runat="server" Text="Root RadTab1" Selected="True">
           </telerik:RadTab>
           <telerik:RadTab runat="server" Text="Root RadTab2">
           </telerik:RadTab>
           <telerik:RadTab runat="server" Text="Root RadTab3">
           </telerik:RadTab>
       </Tabs>
   </telerik:RadTabStrip>
   <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">
       <telerik:RadPageView ID="RadPageView1" runat="server">
           RadPageView1</telerik:RadPageView>
       <telerik:RadPageView ID="RadPageView2" runat="server">
           RadPageView2</telerik:RadPageView>
       <telerik:RadPageView ID="RadPageView3" runat="server">
           RadPageView3</telerik:RadPageView>
   </telerik:RadMultiPage>
   <asp:Button ID="Button1" runat="server" Text="Prev" OnClientClick="onNavigate(false); return false;" />
   <asp:Button ID="Button2" runat="server" Text="Next" OnClientClick="onNavigate(true); return false;" />
</form>

I am horrible at jQuery/Javascript but need the code. I have to make a multi-form wizard. Wanted to see if I can avoid postback since I am using Async Upload on one of the tabs. 

Any suggestion welcome.

1 Answer, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 24 Nov 2011, 12:29 PM
Hi Odin,

Thank you for pointing this one.

I have already fixed this issue in our documentation and it will be available next week. Meanwhile you can refer to the following code:
function onNavigate(isMoveNext)
    var tabs = $find('<%= rtbstMain.ClientID %>');
    var totalNumOfTabs = tabs.get_tabs().get_count();
    if(totalNumOfTabs > 0) {
        var newTabIndex;
        var currentTabIndex = tabs.get_selectedIndex();
 
        if(isMoveNext){
            if(currentTabIndex + 1 == totalNumOfTabs) {
                newTabIndex = 0;
            }
            else {
                newTabIndex = currentTabIndex + 1;
            }
        }
        else{
            if(currentTabIndex - 1 < 0) {
                newTabIndex = totalNumOfTabs - 1;
            }
            else {
                newTabIndex = currentTabIndex - 1
            }
        }
        tabs.set_selectedIndex(newTabIndex);
    }
}

Kind regards,
Kate
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
Odin
Top achievements
Rank 1
Answers by
Kate
Telerik team
Share this question
or