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

Get selected Index of radtab Strip

4 Answers 998 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 06 Feb 2014, 06:44 PM
I am trying to do validation on my multiPages which are part of my radtabStrip on each click of the radtab.  I am trying to the get the selected index of each tab so that I know which one I am on to do the validation.

I must say I give the new site and F, what a frustrating new site.

<telerik:RadTabStrip ID="radESGRTab" runat="server" Orientation="HorizontalTop" MultiPageID="radPageMulti" ClickSelectedTab="true" Skin="Web20" Font-Bold="true" Font-Size="Large" Width="800px" OnClientMouseOver="tabEmployer" OnClientTabSelected="CheckValidation">
              <Tabs>
                  <telerik:RadTab PageViewID="rdPageInfo" Text="Soldier Info" runat="server" SelectedIndex="1"></telerik:RadTab>
                  <telerik:RadTab PageViewID="rdPageEmploy" Text="Employer Info" runat="server" SelectedIndex="2"></telerik:RadTab>
                  <telerik:RadTab PageViewID="rdpageSurvey" Text="Survey Info" SelectedIndex="3"></telerik:RadTab>
                  <telerik:RadTab PageViewID="rdPageAwards" Text="Employer Awards" SelectedIndex="4"></telerik:RadTab>
              </Tabs>
          </telerik:RadTabStrip>



function CheckValidation() {
           var tab1 = $find('<%=radESGRTab.ClientID %>').selectedIndex();
            
           if (tab1 == 1) {
               var combo = $find('<%= ddlSoldCounty.ClientID %>');
               var item = combo.get_selectedItem().get_value();
               alert(combo.get_selectedItem().get_value());
               if (item == 1) {
                   alert('You must pick a county from Drop Down List');
               }
           }
       }
   </script>

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 07 Feb 2014, 05:36 AM
Hi Kevin,

The RadTabStrip supports zero based index of the selected tab. The default value is -1 if no child tab is selected. Please have a look into the following modification I did in your code to get the index of the selected tab.

ASPX:
<telerik:RadTabStrip ID="radESGRTab" runat="server" Orientation="HorizontalTop" MultiPageID="radPageMulti"   ClickSelectedTab="true" Skin="Web20" Font-Bold="true" Font-Size="Large" Width="800px" OnClientTabSelected="CheckValidation">
    <Tabs>
        <telerik:RadTab PageViewID="rdPageInfo" Text="Soldier Info" runat="server" SelectedIndex="0">
        </telerik:RadTab>
        <telerik:RadTab PageViewID="rdPageEmploy" Text="Employer Info" runat="server" SelectedIndex="1">
        </telerik:RadTab>
        <telerik:RadTab PageViewID="rdpageSurvey" Text="Survey Info" SelectedIndex="2">
        </telerik:RadTab>
        <telerik:RadTab PageViewID="rdPageAwards" Text="Employer Awards" SelectedIndex="3">
        </telerik:RadTab>
    </Tabs>
</telerik:RadTabStrip>

JavaScript:
<script type="text/javascript">
    function CheckValidation(sender, args) {
        alert(sender.get_selectedIndex());
    }
</script>

Thanks,
Shinu.
0
Kevin
Top achievements
Rank 1
answered on 07 Feb 2014, 03:00 PM
awesome thank you much.
0
Subin das
Top achievements
Rank 1
answered on 21 Dec 2015, 04:10 PM

Hi Shinu,

     I need to get or set the rad tab selected index on ASP button OnClientClick.

I tried the this code "$find('<%=radESGRTab.ClientID %>').selectedIndex();" But am getting the following error

"Object doesn't support property or method 'selectedIndex"

can you please help me on this

 

Thanks

Subin

 

 

 

0
Ivan Danchev
Telerik team
answered on 24 Dec 2015, 09:55 AM
Hello Subin,

The right client-side method to use in order to get the TabStrip's selected index is: get_selectedIndex()

Regards,
Ivan Danchev
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
TabStrip
Asked by
Kevin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Kevin
Top achievements
Rank 1
Subin das
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or