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

Tab Strip on Master Page

1 Answer 139 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Raymond
Top achievements
Rank 1
Raymond asked on 09 Jan 2015, 03:12 PM
I have created a sample web site that consists of a Master Page with a RadTabStrip and three tabs that link to three content pages ==> PageOne.aspx, PageTwo.aspx, and PageThree.aspx. The Master Page displays the current date/time which changes as each new tab is clicked.

My question, is there a way to have the new pages load without having to reload the Master Page, using Ajax or something. In this simple example, the date / time would not update as each new tab is clicked.

If so, how would I do this.  How would I change this.

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title>Untitled Page</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
   <form id="form1" runat="server">
   <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
   </telerik:RadScriptManager>
   <div>
      <asp:Label ID="lblDateTime" runat="server" Text="Label"></asp:Label>
   </div>
   <div>
      <telerik:RadTabStrip ID="RadTabStrip" runat="server">
         <Tabs>
            <telerik:RadTab Text="Page One" NavigateUrl="PageOne.aspx" Value="PageOne.aspx"></telerik:RadTab>
            <telerik:RadTab Text="Page Two" NavigateUrl="PageTwo.aspx" Value="PageTwo.aspx"></telerik:RadTab>
            <telerik:RadTab Text="Page Three" NavigateUrl="PageThree.aspx" Value="PageThree.aspx"></telerik:RadTab>
         </Tabs>
      </telerik:RadTabStrip>
      <br /><br />
      <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
         
      </asp:ContentPlaceHolder>
   </div>
   </form>
</body>
</html>
 
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="PageOne.aspx.vb" Inherits="PageOne" %>
 
<%@ MasterType VirtualPath="~/MasterPage.master" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <b>Page One</b>
</asp:Content>
 
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="PageTwo.aspx.vb" Inherits="PageOne" %>
 
<%@ MasterType VirtualPath="~/MasterPage.master" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <b>Page Two</b>
</asp:Content>
 
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="PageThree.aspx.vb" Inherits="PageOne" %>
 
<%@ MasterType VirtualPath="~/MasterPage.master" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <b>Page Three</b>
</asp:Content>
 
On Page Load
Public Sub SetCurrentTab()
      Dim tab As RadTab = RadTabStrip.FindTabByValue(System.IO.Path.GetFileName(Request.Url.ToString()))
 
      If tab IsNot Nothing Then
         tab.Selected = True
      End If
   End Sub
End Class

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 14 Jan 2015, 12:08 PM
Hеllo,

I would like to clarify that due to the Asp.Net concept the master page will be loaded on each post-back. A possible solution to avoid printing the current date and time on each post-back you can do that only when the page is initially loaded.
Please refer to code snippet below:
//code behind
protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
           //your code goes here if you want to be executed only on page initial load.
        }
    }



Regards,
Boyan Dimitrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TabStrip
Asked by
Raymond
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or