<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
<%@ Register TagPrefix="uc1" TagName="uc1" Src="~/UserControl.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title></title>
	<telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
	<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
		<Scripts>
			<%--Needed for JavaScript IntelliSense in VS2010--%>
			<%--For VS2008 replace RadScriptManager with ScriptManager--%>
			<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
			<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
			<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
		</Scripts>
	</telerik:RadScriptManager>
	<script type="text/javascript">
		//Put your JavaScript code here.
    </script>
	<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
	</telerik:RadAjaxManager>
	<div>

    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" OnClientTabSelected="OnClientTabSelected">
        <Tabs>
            <telerik:RadTab Text="Tab1" Selected="true"></telerik:RadTab>
            <telerik:RadTab Text="Tab2"></telerik:RadTab>
            <telerik:RadTab Text="Tab3"></telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>

    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">
        <telerik:RadPageView ID="RadPageView1" runat="server" Selected="true">
            <uc1:uc1 ID="UserControl1" runat="server" />
        </telerik:RadPageView>
        <telerik:RadPageView ID="RadPageView2" runat="server">
            <uc1:uc1 ID="UserControl2" runat="server" />
        </telerik:RadPageView>
        <telerik:RadPageView ID="RadPageView3" runat="server">
            <uc1:uc1 ID="UserControl3" runat="server" />
        </telerik:RadPageView>
    </telerik:RadMultiPage>

    <script type="text/javascript">
        function OnClientTabSelected(sender, args)
        {
            var selectedTabIndex = args.get_tab().get_index() + 1; //the tab indexes starts from 0
            var editorId = "UserControl" + selectedTabIndex + "_RadEditor1";//the ID is hard-codded 
            var editor = $find(editorId);

            editor.setFocus();
        }

        function pageLoad()
        {
            var tabStrip = $find('<%=RadTabStrip1.ClientID %>');

            var selectedTabIndex = tabStrip.get_selectedIndex() + 1; //the tab indexes starts from 0
            var editorId = "UserControl" + selectedTabIndex + "_RadEditor1";
            var editor = $find(editorId);

            editor.setFocus();        
        }
    </script>

	</div>
	</form>
</body>
</html>
