![]() |
|
|
|
#1 |
|
Hi,
In one of my database's tables I have a Header and Footer field, which content is used to create the header and footer of my Master page. Part generated from Header field: <html > <head > <title>Untitled Page</title> </head> <body> That's the usual hardcoded content part of the Master Page: <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> and finally the part generated from the Footer field: </body> </html> How can I build the header and footer of my Master page by reading the content of my datasource ?? Thank you samuelberthelot@googlemail.com |
|
|
|
|
#2 |
|
Posts: n/a
|
Sam,
You'll need to modify your application to not use the header and footer from your database. Let asp.net render the <head> <html> <body> tags. You can change the page title with page.title="hello world" . You can add your meta tags to the head element in the masterpage with a usercontrol. Good Luck DWS "" wrote: > Hi, > In one of my database's tables I have a Header and Footer field, which > content is used to create the header and footer of my Master page. > > > Part generated from Header field: > <html > > <head > > <title>Untitled Page</title> > </head> > > <body> > > That's the usual hardcoded content part of the Master Page: > <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> > > and finally the part generated from the Footer field: > </body> > </html> > > How can I build the header and footer of my Master page by reading the > content of my datasource ?? > > Thank you > > |
|
|
|
#3 |
|
Posts: n/a
|
Well it's the way the whole system work, i'm afraid i can't change that
and i'm not the one who has designed this. Actually I've managed to achieve this: In the code-behind of my master page, if it's not a PostBack, I read the header an footer from database and store them in two session variable. I write them using response.write and the page is built correctely. Only issue I have is with .css, mentionned in another post of mine. |
|
|
|
#4 |
|
Posts: n/a
|
In article < om>,
writes >Well it's the way the whole system work, i'm afraid i can't change that >and i'm not the one who has designed this. Well, it might be worth speaking to whoever did design it and explaining that it's not a very good solution. >Actually I've managed to achieve this: > >In the code-behind of my master page, if it's not a PostBack, I read >the header an footer from database and store them in two session >variable. I write them using response.write and the page is built >correctely. What happens when the session runs out? Say someone loads a page, then goes for a cup of tea, comes back after the session has expired and submits the page? Your session variable will be empty, but you only populate it on postback, so your header and footer will not appear. BY the way, using response.write is not a recommended way to build pages anymore. It was fine in classic ASP, but there are much better ways in ASP.NET. > Only issue I have is with .css, mentionned in another post >of mine. I suspect you will find bigger issues than that as time goes on unless you rethink your approach. You are going about things in a very "classic ASP" way, not a recipe for success. I would rethink this very carefully before proceeding. You should only store the header and footer *content* (eg, page title, meta keywords, etc) in the database, and *not* the tags. HTML should be left for the pages themselves. HTH -- Alan Silver (anything added below this line is nothing to do with me) |
|