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

Passing selected tab index via radbutton client side function

1 Answer 93 Views
Button
This is a migrated thread and some comments may be shown as answers.
PALAK
Top achievements
Rank 1
PALAK asked on 16 Sep 2016, 11:12 AM

Hi

 

I am trying to pass selected index via client side function with below code 

<telerik:RadButton ID="btnDeliverySetting" ClientIDMode="Static" OnClientClicking="function(button,args){getRadTabStrip('<%=NotificationsWizardTS.SelectedIndex%>','<%=NotificationTypesTS.SelectedIndex%>');}" runat="server" Text="Continue" ButtonType="StandardButton"  CssClass="btn_Normal">
                            </telerik:RadButton>

 

and at client side my function is as under 

 

function getRadTabStrip(NotificationsWizardTSIndex, NotificationTypesTSIndex) {
        alert("Wizard" + NotificationsWizardTSIndex);
        alert("Type" + NotificationTypesTSIndex);

}

 

This is alerting just string "Wizard<%=NotificationsWizardTS.SelectedIndex%>" and "Type<%=NotificationsTypeTS.SelectedIndex%>"

 

How can i pass indexof both selected tabs?

1 Answer, 1 is accepted

Sort by
0
Anton
Telerik team
answered on 19 Sep 2016, 06:45 AM
Hello Palak,

get_selectedIndexes() gives you an array of all selected tabs. You can check on the example below:

<telerik:RadScriptManager runat="server"></telerik:RadScriptManager>
        <div>
            <telerik:RadTabStrip RenderMode="Lightweight" ID="RadTabStrip1" runat="server">
                <Tabs>
                    <telerik:RadTab
                        runat="server"
                        Text="Tab1"
                        PerTabScrolling="True"
                        ScrollChildren="false"
                        Selected="True">
                        <Tabs>
                            <telerik:RadTab runat="server" Text="Child Tab 1" />
                            <telerik:RadTab runat="server" Text="Child Tab 2" />
                            <telerik:RadTab runat="server" Text="Child Tab 3" />
                            <telerik:RadTab runat="server" Text="Child Tab 4" />
                            <telerik:RadTab runat="server" Text="Child Tab 5" Selected="True" />
                        </Tabs>
                    </telerik:RadTab>
                    <telerik:RadTab runat="server" Text="Tab2" />
                    <telerik:RadTab runat="server" Text="Tab3" />
                </Tabs>
            </telerik:RadTabStrip>
 
            <telerik:RadButton ID="btnDeliverySetting" AutoPostBack="false" ClientIDMode="Static" OnClientClicking="onClientClicking" runat="server" Text="Continue" ButtonType="StandardButton" CssClass="btn_Normal">
            </telerik:RadButton>
        </div>
        <script>
            function onClientClicking(sender, args) {
                var tabStrip = $find("<%= RadTabStrip1.ClientID %>"),
                    indexesOfSelectedTabs = tabStrip.get_selectedIndexes();
 
                console.log(indexesOfSelectedTabs);
            }
        </script>


Regards,
Anton
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Button
Asked by
PALAK
Top achievements
Rank 1
Answers by
Anton
Telerik team
Share this question
or