How to set Page Title Global events

Posted by Jayakumars under ASP.NET on 11/17/2011 | Points: 10 | Views : 1310 | Status : [Member] [MVP] | Replies : 2

I have 40 Pages in my web application here i need every time i have assign every
page in my every page load event like this.

lbl1.Text = Page.Title = "Department";

here i need how to set this global or how to set resources and then retrieve
but i need simplify any idea to set master page then populate every page but
i did not mention every page how will do from master i need most urgent this

Mark as Answer if its helpful to you


Posted by: Blessyjees on: 11/17/2011 [Member] Bronze | Points: 25


Add a master page in your application and put all information that you need to in every page, see below sample

<html xmlns="" xml:lang="en">

<head runat="server">
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<form runat="server">
<div class="page">
<div class="header">
<div class="title">
My ASP.NET Application
<div class="clear hideSkiplink">
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
<asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
<asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>
<asp:MenuItem NavigateUrl="~/UserList.aspx" Text="Users" />
<div class="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
<div class="clear">
<div class="footer">


Then add your child pages that will change look like below. Please note that the sample code the value of "ContentPlaceHolderID" is same as the of master pages's content place holder id.
<%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="About.aspx.cs" Inherits="WebApplication1.About" %>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
Put content here.

Blessy Baby
Digitalmesh Softech pvt Ltd

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 11/18/2011 [Member] Starter | Points: 25

I gone through above code but title doesn't appear .

ER sandeep chourasia (on facebook)

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response