|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
dynamic master page contentIn 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 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 Show quoteHide quote "samuelberthe***@googlemail.com" 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 > > 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. In article <1140625573.204893.7***@g43g2000cwa.googlegroups.com>,
samuelberthe***@googlemail.com writes >Well it's the way the whole system work, i'm afraid i can't change that Well, it might be worth speaking to whoever did design it and explaining >and i'm not the one who has designed this. that it's not a very good solution. >Actually I've managed to achieve this: What happens when the session runs out? Say someone loads a page, then > >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. 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 I suspect you will find bigger issues than that as time goes on unless >of mine. 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)
Other interesting topics
PublishState.xml
Need help with GridView and LDAP/GC problem dynamically removing items from a droplist..? Clarification on XML schema ????? Register script block from app_code daab and mysql Using reflection to read the page properties... Default values in a FormView App Directory Problem with ASP.NET Development Server |
|||||||||||||||||||||||