473,796 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Master page title disappearing

Hi,

I'm using ASP.NET 2.0's master pages feature (very nice), and I'm
setting the page title programatically (Master.Page.Ti tle = "abc";)
based on a database read.

Whenever a button is pushed on the page, the page reloads, the
!Page.IsPostbac k is [correctly] skipped, but the title on the master
page is reset to the default.

Does anyone know a way to stop this this, or do I have to re-read from
my database every page hit?

Feb 7 '06 #1
1 1224
As you've noticed, the title value isn't automatically kept. How you deal
with that is really up to you. You can reload from the database, you can
store it in viewstate or in the cache.

if (!IsPostBack)
{
Title = "abc";
ViewState.Add(" Title", "abc");
}
else
{
Title = (string)ViewSta te["Title"];
}

Of course, i'd consider storing it in the cache if the titles are global to
each user.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Dunc" <du**********@g mail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi,

I'm using ASP.NET 2.0's master pages feature (very nice), and I'm
setting the page title programatically (Master.Page.Ti tle = "abc";)
based on a database read.

Whenever a button is pushed on the page, the page reloads, the
!Page.IsPostbac k is [correctly] skipped, but the title on the master
page is reset to the default.

Does anyone know a way to stop this this, or do I have to re-read from
my database every page hit?

Feb 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3618
by: Mark | last post by:
I'm interested in displaying a dynamic page title, rather than the static html <title>My Page</title>. In a previous posting, I had seen a suggestion of making the title into a server control using syntax like: <TITLE id="objTitle" runat="server" /> However, this works for a while, but VS.NET always eventually removes the runat attribute, and my code bombs. One reason might be that it isn't included in the <form> tag?? Can the...
4
1559
by: rmccinc | last post by:
Hello- I am missing something very easy here I think. I have 3 files test.master.vb (Master) content.aspx.vb (content) Control.ascx.vb (user Control)
1
1874
by: Alan Silver | last post by:
Hello, I am just experimenting with master pages, and am trying to add a content placeholder in the <head> section, so that individual pages can set their own page title and meta tags. The master page looks like this... <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
5
2087
by: Howard | last post by:
i have a default.master and default.aspx in default.aspx i would like to access a variable in default.master pageTitle public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {
4
1874
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses more than one master page. Currently, there are two pages, Freedom1.master and Freedom2.master. I have no problems with Freedom1.master. However, I am having problems with Freedom2.master. The first problem is I sometimes get the following error when I build the site. The type 'Freedom2' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
3
6444
by: ivanpais | last post by:
Hi, I have a Web User Control, Lets say "Foo.ascx", that contains a button "btnFoo". I have a Master Page "Bar.master", that has a label "lblBar". This label is exposed by a public property BarLabelText. I now have a contentpage "FooBar.aspx", where "Bar.master" is the master page and in the content section has the control "Foo.ascx".
17
3162
by: Rob R. Ainscough | last post by:
Again another simple concept that appears NOT to be intuitive or I'm just stupid. I've read the WROX book and the example doesn't actually show how the .master page links in the other content pages? Kinda sorta a critical point no? Am I missing something? Rob. P.S. the day I find a book that actually is useful rather than just a
6
1879
by: Rippo | last post by:
Is it possible to turn off the title tag in the page directive when using master pages? We have got meta data and title defined in a content control and are ending up with 2 title tags, one defined in our content and an emty one defined by the page directive. Can anyone help??
5
2284
by: xlar54 | last post by:
I have a very simple 2.0 website (framework), that uses a master page...not. I added the default.aspx page as a webcontent form, with the master page as it's master page, but the master page is never displayed. Not sure whats wrong. Below is my code. Any help would be appreciated. VS2008. MasterPage1.Master: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage1.master.cs"
0
9684
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9530
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10236
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10017
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7552
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6793
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.