Submit behaviour when clicking tab

2 posts, 0 answers
  1. CabinetZulian
    CabinetZulian avatar
    12 posts
    Member since:
    Apr 2007

    Posted 28 Nov 2011 Link to this post


    We have a page with radtabstrip, and we're dynamically loading user controls when clicking on tabs.

    In order to get the usercontrol state persists with viewstate, we reload them in in the page's onload event.

    When we click on another tab than the selected one (let say tab index 0 => 2), we don't want to reload the tab 0's user control, but it's not possible as the TabClick event occurs after the Page's OnLoad one...

    Is anyone have a solution ?

    Best regards,
  2. Bozhidar
    Bozhidar avatar
    1096 posts

    Posted 29 Nov 2011 Link to this post

    Hi Cabinetzulian,

    You can use the client  OnClientTabSelecting event to get the index of the selected tab. This event fires before any server-side events. You can store the index in a hiddnes field in the page, and then get it in the PageLoad event.
    Here's an example:

        <form id="form1" runat="server">
        <asp:ScriptManager runat="server" />
        <script type="text/javascript">
        function TabSelecting(sender, args){
            var tab = args.get_tab();
            var index = tab.get_index();
            <telerik:RadTabStrip ID="RadTabStrip1" runat="server"
                    <telerik:RadTab Text="tab1" />
                    <telerik:RadTab Text="tab2" />
            <asp:HiddenField ID="hiddenField" Value="0" runat="server" />

    protected void Page_Load(object sender, EventArgs e)
        int tabIndex = Int32.Parse(hiddenField.Value);

    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
  3. Telerik UI for ASP.NET Core is out
Back to Top