473,804 Members | 4,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1318
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***@batamrea lty.com> wrote in message
news:O5******** ********@TK2MSF TNGP10.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 programmaticall y using the Page.MasterPage File
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 InvalidOperatio nException exception.

HTH,

Matt Dinovo

"Newbie" <ad***@batamrea lty.com> wrote in message
news:O5******** ********@TK2MSF TNGP10.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******** *****@TK2MSFTNG P09.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***@batamrea lty.com> wrote in message
news:O5******** ********@TK2MSF TNGP10.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
5484
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 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
1
2791
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. So the masterpage code would 1) create the public string DBConn and 2) check the public string SubLinks if it contains any links after the content page was run (if not, hide the sublink bar). Using Page_OnLoad event the masterpage code is run...
2
1460
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 uses the web.config specified master) and I go into design view for the aspx, I get the following error: Error Creating Control - Content Content controls can only be used in a content page
5
1744
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 between them it don't work, if the default masterpage is "onepanel.master" and try to change it in runtime, ContentPanel2 which is exist in the loaded masterpage throw exception.. the same happen if the default is "twopanel.master" and switch it...
12
4934
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
1476
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 the place holder for the main portion of the body of the site my question is, is there a way to test what aspx page will be loaded into the contentplaceholder? basically if it is our home page, that page has a wider definition than all of our...
0
2434
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 but I am stuck at this point. I am new to asp.net and this is my first website. Below is my code please help. Content controls have to be top-level controls in a content page or a nested master page that references a master page. ...
6
3594
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 hierarchy). I tried adding <link type="text/css" rel="stylesheet" href="~/Shared/CSS/Standard.css" runat="server" /> in the <headsection of the MasterPage. When I look at the source of my pages later when I'm running it, it *does* seem to...
2
1647
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 website the menu items default to forecolor=green and onHover=orange. I am setting and binding the sitemap provider programmatically at runtime. Could this be why the properties are not being applied?
0
9710
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
9589
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
10593
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9163
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
7626
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
6858
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
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.