473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.Title = "abc";)
based on a database read.

Whenever a button is pushed on the page, the page reloads, the
!Page.IsPostback 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 1205
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)ViewState["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**********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.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.Title = "abc";)
based on a database read.

Whenever a button is pushed on the page, the page reloads, the
!Page.IsPostback 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
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...
4
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
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...
5
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...
4
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,...
3
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...
17
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...
6
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...
5
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...

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.