473,387 Members | 1,388 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.

HELP: Setting masterpage at runtime

Hi,

For my recent web project, I need to built a site which has 3 language. The
content pages are identical, so it only the language that differ. What I
planned is: I'll build a masterpage for each language, and fill up the
content from the database, based on selected language. My question is: is it
possible to determine what masterpage to use at runtime, that is based on
visitors choice of language.

Or, are there any other alternatives/approaches to solve this?

TIA,
Andy
Jan 24 '06 #1
3 1298
The master page can be set during the preInit phase - the event is
specifically put there for this purpose. You can learn more from:
http://odetocode.com/Blogs/scott/arc...2/09/2604.aspx

You might wanna read this 3parter on creatling multilingual pages:
http://openmymind.net/index.aspx?documentId=3
http://openmymind.net/index.aspx?documentId=4
http://openmymind.net/index.aspx?documentId=52

it'll give you some ideas about how to persist user choices and how to
create server controls to make it easier. You can implement your own
ResourceManager (as is done in the article), or not, based on your own
needs, but the other ideas are certainly worth looking at.

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Newbie" <ad***@batamrealty.com> wrote in message
news:O5****************@TK2MSFTNGP10.phx.gbl...
Hi,

For my recent web project, I need to built a site which has 3 language.
The content pages are identical, so it only the language that differ. What
I planned is: I'll build a masterpage for each language, and fill up the
content from the database, based on selected language. My question is: is
it possible to determine what masterpage to use at runtime, that is based
on visitors choice of language.

Or, are there any other alternatives/approaches to solve this?

TIA,
Andy

Jan 24 '06 #2
You can set the masterpage programmatically using the Page.MasterPageFile
property. However, according to MSDN:

The MasterPageFile property is the name of the master page file associated
with this page. The MasterPageFile property can be set only in the PreInit
event; attempting to set the MasterPageFile property after the PreInit event
will throw an InvalidOperationException exception.

HTH,

Matt Dinovo

"Newbie" <ad***@batamrealty.com> wrote in message
news:O5****************@TK2MSFTNGP10.phx.gbl...
Hi,

For my recent web project, I need to built a site which has 3 language.
The content pages are identical, so it only the language that differ. What
I planned is: I'll build a masterpage for each language, and fill up the
content from the database, based on selected language. My question is: is
it possible to determine what masterpage to use at runtime, that is based
on visitors choice of language.

Or, are there any other alternatives/approaches to solve this?

TIA,
Andy

Jan 24 '06 #3
Hi Karl,

Thanks a lot for the references. Seems a bit complicated, though, but I
think it's just what I need.
I appreciate it.

Regards,
andy

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:Oo*************@TK2MSFTNGP09.phx.gbl...
The master page can be set during the preInit phase - the event is
specifically put there for this purpose. You can learn more from:
http://odetocode.com/Blogs/scott/arc...2/09/2604.aspx

You might wanna read this 3parter on creatling multilingual pages:
http://openmymind.net/index.aspx?documentId=3
http://openmymind.net/index.aspx?documentId=4
http://openmymind.net/index.aspx?documentId=52

it'll give you some ideas about how to persist user choices and how to
create server controls to make it easier. You can implement your own
ResourceManager (as is done in the article), or not, based on your own
needs, but the other ideas are certainly worth looking at.

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Newbie" <ad***@batamrealty.com> wrote in message
news:O5****************@TK2MSFTNGP10.phx.gbl...
Hi,

For my recent web project, I need to built a site which has 3 language.
The content pages are identical, so it only the language that differ.
What I planned is: I'll build a masterpage for each language, and fill up
the content from the database, based on selected language. My question
is: is it possible to determine what masterpage to use at runtime, that
is based on visitors choice of language.

Or, are there any other alternatives/approaches to solve this?

TIA,
Andy


Jan 24 '06 #4

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

Similar topics

8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
1
by: Daves | last post by:
I am using 2.0 masterpages. All content pages use some common variables, for example the DB connection string. Also some pages return links which are located in a "sublink" area in the masterpage....
2
by: Brian Orrell | last post by:
I have set the masterPageFile property in my web.config as follows: <pages masterPageFile="~/Main.master" > When I create a webform and I don't specify a masterPageFile in the aspx (so that it...
5
by: Islamegy® | last post by:
In my project i have two master page which i change dynamic in runtime.. The first one with 1 ContentPanel "onepanel.master", the second with 2 contentPanel"twopanel.master".. but when i switch...
12
by: Mark Rae | last post by:
Hi, It's easy enough for a child page to manipulate its MasterPage's header simply by modifying the MasterPage thus: <header runat="server"> .... .... </header>
11
by: simon | last post by:
Hello, I'm helping write a .net app, we are using VS2005 and asp/vb.net for code we are using the "masterPage.master" technique, within the masterpage we have an asp:contentplaceholder that is...
0
by: tasmontique | last post by:
I hope someone can help me. I have an error that I can not seem to figure out. All I need is an unbound dropdownlist to navigate to urls withing the website. I have gotten as far as to populate field...
6
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
I want to insert a CSS Stylesheet file in a <LINKtag inside my MasterPage so that it will work in all of the the ASPX pages that use that MasterPage (no matter where the page is in the directory...
2
by: SE.Computerguy | last post by:
I have a webcontrols menu on my webform (masterpage) that does not display the font color properties I set. In the IDE I set the properties and can see them in the html code but when I run the...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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...

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.