473,811 Members | 3,260 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Master-Content in Asp.net - How to set individual Head for each content page

Hello,
Master-Content in asp.net is very powerful.
But:
I have the following:
One Master-Form.
30 Content-Forms which are the webpages used.
Each of this content-forms must have own html-Head-informations.
Example
Master:
<head>
..... for alle content pages
</head>

ContentPage01
<head>
..... from master
individual for this page, for example:
javascript includes
meta-tags
css-style-sheets
</head>

ContentPage02
<head>
..... from master
individual for this page, for example:
javascript includes
meta-tags
css-style-sheets
</head>

etc.

So what to do.
It is not possible to have <head>.... </headin content-pages.
It is not possible to put all in the <head></headin the master
because is different for each page.

So, what to do?
Thank you for any help.
Rolf Welskes
Aug 21 '06 #1
7 2201
"Rolf Welskes" <ro**@nospam.no spamwrote in message
news:OA******** ******@TK2MSFTN GP06.phx.gbl...
So, what to do?
In the Page_Load of the content pages:

protected void Page_Load(objec t sender, EventArgs e)
{
Header.Title = "Whatever you like";
}
Aug 21 '06 #2
Check out the System.Web.UI.H tmlControls namespace [1] and study the
HtmlHead, HtmlMeta, HtmlLink classes and so on.

The challenge is how and what to code to the header for various content
pages. You'll have to start using a base class all content pages inherit
from. From the Page_PreInit handler of the base class your code will invoke
another class with methods that can determine which content page is about to
be used and subsequently which classes from the HtmlControls namespace are
to be used given the circumstantial requirements for that specific content
page.

Clear as mud?

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee. com
URL http://clintongallagher.metromilwaukee.com/
MAP 43°2'17"N 88°2'37"W : 43°2'17"N 88°2'37"W

[1] http://msdn2.microsoft.com/en-us/lib...lcontrols.aspx
"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:et******** ******@TK2MSFTN GP04.phx.gbl...
"Rolf Welskes" <ro**@nospam.no spamwrote in message
news:OA******** ******@TK2MSFTN GP06.phx.gbl...
>So, what to do?

In the Page_Load of the content pages:

protected void Page_Load(objec t sender, EventArgs e)
{
Header.Title = "Whatever you like";
}

Aug 21 '06 #3
the @Page directive in content page has a attribute "title", so you can
modify it to meet your requirememt,e.g .,
<%@ Page Language="C#" MasterPageFile= "~/MasterPage.mast er" Title="XXX"
%>

Aug 22 '06 #4
Hello Rolf,

For your scenario, do you think it possible and doable that we use code to
programmaticall y create and add html items into the <headersectio ns of
content page? If so, you can consider dynamically creating those html
header items (as Clinton has mentioned) and add them into your content
page's Header. .e.g.

=============== =============== =====
protected void Page_Load(objec t sender, EventArgs e)
{
// modify existing <metadefined in master page
HtmlMeta meta = Page.Header.Fin dControl("metaR edirect") as HtmlMeta;

meta.Content = "";// "2;URL=http ://msdn2.microsoft .com/";

// adding new elements into content page's header

HtmlLink link = new HtmlLink();
link.Href = "~/styles/default.css";
link.Attributes["rel"] = "stylesheet ";

Page.Header.Con trols.Add(link) ;
HtmlGenericCont rol script = new HtmlGenericCont rol("script");
script.Attribut es["src"] = Page.ResolveUrl ("~/scripts/default.js");

Page.Header.Con trols.Add(scrip t);

............... ...
}

=============== =============== ====

Hope this helps.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.


Aug 22 '06 #5

Hello,
thank you for the comments, I think it will help to solve the problem.

BUT:
All is done in program code.

Hint for Microsoft:

It would be very easy to have a head-tag
<head>.... </headalso in the content pages and when merging content and
master,
simple the head information of the content is append in the master.

This would be more simple, because I could code in html and not to write
program code
that generates html.

Thank you again.
Rolf Welskes
Aug 22 '06 #6
"Rolf Welskes" <ro**@nospam.no spamwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
This would be more simple, because I could code in html and not to write
program code that generates html.
Do you have a problem writing code...?
Aug 22 '06 #7
Thanks for your quick reply Rolf,

Though I'm not sure whether this is already added into the plan of next
version of ASPNET, it is really a good ideas to submit this request on our
feedback center:

#Visual Studio and .NET Framework Feedback
http://connect.microsoft.com/feedbac...spx?SiteID=210

Also, you can vote any other existing feedback there so that the product
team can get more comments and consider the update plan on the products.

Thanks again for your posting and feedback.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 22 '06 #8

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

Similar topics

1
3504
by: Moti | last post by:
I have SQL server 2000 which recently crashed. I try to recover it and found out that the Master database is corrupt. I never backup my server using inline sql backup nor any third party backup program that aware to SQL server. But I have full system backup of volume c on tape (using NTBackup), which includes old version of Master database. My questions are: 1. How can I recover this file into SQL server? 2. If so, it is not risky to...
3
18992
by: Sander Smeenk | last post by:
Hello! I'm trying to set up replication between two servers and even though I did everything according to the documentation, the slave keeps failing to connect to the master like this: | 050119 0:23:43 Slave SQL thread initialized, starting replication in | log 'zwart-bin.001' at position 79, relay log './blauw-relay-bin.001' | position: 4 | 050119 0:23:43 Slave I/O thread: error connecting to master
0
3257
by: webhosting | last post by:
After a failure, we promoted a slave to master. This included renaming the server to the old master's name and ip address, but leaving the server id alone. The new master works fine. We repaired the old server, gave it a different name and ip address but leaving the server id the same. I get the following error on the slave:
1
1573
by: HS1 | last post by:
Hello all - I have a master and a details table presented in two datagrid - I also have some text boxes that present the values from any record in the master table. This also helps to enter new data for the master table. I also have a Add button to add new data Me.BindingContext(masterGrid.DataSource, "masterTable").AddNew()
0
931
by: Geoff Sullivan | last post by:
Are controls inside a nested master accessible? I have a master (b) which references another master (A). In master (b) I has several ASP controls. On the Page_Load of master (b), I can't seem to reference those ASP controls. In the debugger, it shows that master (b) only contains 1 control in the Controls collection and that single control is a reference to master (a)! The debugger also shows the ASP controls as members of master (b),...
6
7045
by: brian.j.parker | last post by:
I inherited an application (or two) that run on SQL Server 6.5, which I haven't used in years, and am having a problem. I get the error: ------------------------------------------------------------------------ Can't allocate space for object 'Syslogs' in database 'master' because the 'logsegment' segment is full. If you ran out of space in Syslogs, dump the transaction log. Otherwise, use ALTER DATABASE or sp_extendsegment to increase...
3
1266
by: AmitKu | last post by:
My site has a header and footer that is common to all pages on the site. It makes sense that this should be stored within a master, and have everybody go off of this one. However, one part of my site (20 pages) has a nav bar, and I'd like to use a master to represent this. Instead of having the header and footer again in this new master, I'd like to have it "derive" from that first master. Is this possible, and how can I achieve...
2
2289
by: John | last post by:
Hi I am trying to create a master/detail form. I have my master and details tables dragged onto the dataset. I have also dragged the fields from master table on the form which has created the navigation toolbar for me and which works fine with the master table. I also have a dataview on the same form ready for detail table but as yet not assigned to the detail table. How can I now create a master/detail relationship between my master and...
2
3124
by: hlnet | last post by:
I am newbie. I want use query : SELECT public.Master.ID, public.Master.Description from Master , but ->Error missing table Master .If use query : SELECT "public"."Master"."ID", "public"."Master"."Description" from "Master" It is OK. SELECT "ID", "Description" from "Master". It's OK SELECT ID, Description from "Master" . ERROR : column "id" does not exist at character 8.
4
2969
by: harijay | last post by:
Hi I am new to writing module and object oriented python code. I am trying to understand namespaces and classes in python. I have the following test case given in three files runner , master and child. I am getting an error within child where in one line it understands variable master.name and in the next line it gives a NameError as given here " print "Reset name now from %s to %s , oldname %s is saved in mastertrash" %...
0
9734
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
10656
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
10397
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...
1
10410
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7674
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
5564
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4353
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
2
3878
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.