Passing selected tab index via radbutton client side function

2 posts, 0 answers
  1. PALAK
    PALAK avatar
    1 posts
    Member since:
    Sep 2016

    Posted 16 Sep Link to this post

    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?

  2. Anton
    Admin
    Anton avatar
    58 posts

    Posted 19 Sep Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top