Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.NET/VB: Inserting Title with Master Page

Posted on 2014-01-28
4
Medium Priority
?
293 Views
Last Modified: 2014-02-12
How can I insert the title from <%@ Page Title="" (Hello World Title) into my page?

Here is my master page:
<% @ Master Language="VB" %>
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
</head>
<body>  

<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>

</body>
</html>

Open in new window

Here is my page:

<%@ Page Title="Hello World Title" Language="VB" MasterPageFile="~/master.master" AutoEventWireup="false" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<h1>Hello World</h1>

</asp:Content>

Open in new window

0
Comment
Question by:hankknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 600 total points
ID: 39814956
You have specified the Title in the page directive so that will get rendered as <title> in the head tag automatically.
0
 
LVL 15

Expert Comment

by:pateljitu
ID: 39815251
Please try code as suggested below:

For Master page:
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
    Me.Page.Title = "Hello World Title - MASTER"
End Sub

Open in new window


For pages:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Me.Page.Title = "Hello World Title"
End Sub

Open in new window

0
 
LVL 16

Author Comment

by:hankknight
ID: 39815293
I have specified the Title in the page directive but it does not get rendered automatically.

I want the data from this to be used:
<%@ Page Title="Hello World"Why isn't it automatically working?
0
 
LVL 15

Accepted Solution

by:
pateljitu earned 1400 total points
ID: 39815397
When accessing "Page" you should be seeing title as "Hello World Title".

1. What are you currently seeing when you render page? If not header add title to MASTER page and see the difference.
2. Try code-behind title change as provided earlier, just to test functionality.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question