Select PageView based on drop down item.

2 posts, 1 answers
  1. Karl Ranville
    Karl Ranville avatar
    28 posts
    Member since:
    Mar 2013

    Posted 10 Apr 2013 Link to this post

    Hi,

    There is a drop down list and a RadTabStrip. When I select an item from the drop down, is it possible to select a corresponding page view  based on value and index? The drop down value and pageview index are same.

    Thanks,
    Karl.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 Apr 2013 Link to this post

    Hi Karl,

    Please have a look at the sample code which works fine at my end.

    ASPX:
    <telerik:RadTabStrip ID="RadTabStrip" runat="server" MultiPageID="RadMultiPage1" OnTabClick="RadTabStrip1_TabClick"
        Width="300px" Skin="WebBlue">
        <Tabs>
            <telerik:RadTab runat="server" Text="JSP" PageViewID="RadPageView1">
            </telerik:RadTab>
            <telerik:RadTab runat="server" Text="ASP" PageViewID="RadPageView2">
            </telerik:RadTab>
            <telerik:RadTab runat="server" Text="JSF" PageViewID="RadPageView3">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server">
        <telerik:RadPageView ID="RadPageView1" runat="server">
            <br /><br />Page View 1
        </telerik:RadPageView>
        <telerik:RadPageView ID="RadPageView2" runat="server">
            <br /><br />Page View 2
        </telerik:RadPageView>
        <telerik:RadPageView ID="RadPageView3" runat="server">
            <br /><br />Page View 3
        </telerik:RadPageView>
    </telerik:RadMultiPage>
    <br />
    <br />
    <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="false" EmptyMessage="Select Topic" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged">
        <Items>
            <telerik:RadComboBoxItem runat="server" Text="JSP" Value="0" />
            <telerik:RadComboBoxItem runat="server" Text="ASP" Value="1" />
            <telerik:RadComboBoxItem runat="server" Text="JSF" Value="2" />
        </Items>
    </telerik:RadComboBox>

    JavaScript:
    <script type="text/javascript">
        function OnClientSelectedIndexChanged(sender, args) {
            var pageView = $find("<%= RadMultiPage1.ClientID %>");
            var RadTabStrip = $find("<%= RadTabStrip.ClientID %>");
            var selectedItem = args._item._text;
            var tab = RadTabStrip.findTabByText(selectedItem).set_selected(true);       
            pageView.get_pageViews().getPageView(args._item.get_value()).set_selected(true);
        }
    </script>

    C#:
    protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
    {
        RadComboBox1.SelectedIndex = RadMultiPage1.SelectedIndex;
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top