![]() |
|
|
|
#1 |
|
Hi
Is it possible to change dynamically <title></title> section in page. What I want is to have <title> section depended on values retrieved from database. The question could be extended to other sections from <HEAD> section. If it's possible please provide an example (ideally in C#). Best Regards Darek Dariusz Tomon |
|
|
|
|
#2 |
|
Posts: n/a
|
In ASP.NET 2.0 you can use Page.Title to set the title of the page. In
ASP.NET 1.1 you can put a Literal control in the title tag. Dariusz Tomon wrote: > Hi > > Is it possible to change dynamically <title></title> section in page. What I > want is to have <title> section depended on values retrieved from database. > The question could be extended to other sections from <HEAD> section. > If it's possible please provide an example (ideally in C#). > > Best Regards > > Darek |
|
|
|
#3 |
|
Posts: n/a
|
If you are using Master pages with ASP.NET 2.0 you can see the power of ~
here : http://www.dotnetgenerics.com/Module...erOfTilda.aspx -- Swanand Mokashi Microsoft Certified Solution Developer (.NET) - Early Achiever Microsoft Certified Application Developer (.NET) http://www.dotnetgenerics.com/ DotNetGenerics.com -- anything and everything about Microsoft .NET technology ... http://www.swanandmokashi.com/ http://www.swanandmokashi.com/HomePage/WebServices/ Home of the Stock Quotes, Quote of the day and Horoscope web services "Göran Andersson" <> wrote in message news:... > In ASP.NET 2.0 you can use Page.Title to set the title of the page. In > ASP.NET 1.1 you can put a Literal control in the title tag. > > Dariusz Tomon wrote: >> Hi >> >> Is it possible to change dynamically <title></title> section in page. >> What I want is to have <title> section depended on values retrieved from >> database. The question could be extended to other sections from <HEAD> >> section. >> If it's possible please provide an example (ideally in C#). >> >> Best Regards >> >> Darek |
|
|
|
#4 |
|
Posts: n/a
|
unfortunatelly I'm using ASP.NET 1.1 so could you provide an example?
Best Regards Darek T. "Göran Andersson" <> wrote in message news:... > In ASP.NET 2.0 you can use Page.Title to set the title of the page. In > ASP.NET 1.1 you can put a Literal control in the title tag. > > Dariusz Tomon wrote: >> Hi >> >> Is it possible to change dynamically <title></title> section in page. >> What I want is to have <title> section depended on values retrieved from >> database. The question could be extended to other sections from <HEAD> >> section. >> If it's possible please provide an example (ideally in C#). >> >> Best Regards >> >> Darek |
|
|
|
#5 |
|
Posts: n/a
|
<title><asp:Literal id="asdf" runat="server"/></title>
asdf.Text = "First page"; Dariusz Tomon wrote: > unfortunatelly I'm using ASP.NET 1.1 so could you provide an example? > > Best Regards > > Darek T. > > "Göran Andersson" <> wrote in message > news:... >> In ASP.NET 2.0 you can use Page.Title to set the title of the page. In >> ASP.NET 1.1 you can put a Literal control in the title tag. >> >> Dariusz Tomon wrote: >>> Hi >>> >>> Is it possible to change dynamically <title></title> section in page. >>> What I want is to have <title> section depended on values retrieved from >>> database. The question could be extended to other sections from <HEAD> >>> section. >>> If it's possible please provide an example (ideally in C#). >>> >>> Best Regards >>> >>> Darek > > |
|
|
|
#6 |
|
Posts: n/a
|
ok - it works - thank you
"Göran Andersson" <> wrote in message news:... > <title><asp:Literal id="asdf" runat="server"/></title> > > asdf.Text = "First page"; > > Dariusz Tomon wrote: >> unfortunatelly I'm using ASP.NET 1.1 so could you provide an example? >> >> Best Regards >> >> Darek T. >> >> "Göran Andersson" <> wrote in message >> news:... >>> In ASP.NET 2.0 you can use Page.Title to set the title of the page. In >>> ASP.NET 1.1 you can put a Literal control in the title tag. >>> >>> Dariusz Tomon wrote: >>>> Hi >>>> >>>> Is it possible to change dynamically <title></title> section in page. >>>> What I want is to have <title> section depended on values retrieved >>>> from database. The question could be extended to other sections from >>>> <HEAD> section. >>>> If it's possible please provide an example (ideally in C#). >>>> >>>> Best Regards >>>> >>>> Darek >> |
|
|
|
#7 |
|
Posts: n/a
|
Hi,
Göran Andersson wrote: > <title><asp:Literal id="asdf" runat="server"/></title> > > asdf.Text = "First page"; I prefer this way: <title runat="server" id="pageTitle">Default title</title> and then: HtmlGenericControl windowTitle = FindControl( "title" ) as HtmlGenericControl; if( windowTitle == null ) throw new ApplicationException( "..." ); windowTitle.InnerHtml = "My title"; HTH Laurent -- Laurent Bugnion, GalaSoft Software engineering: http://www.galasoft-LB.ch Private/Malaysia: http://mypage.bluewin.ch/lbugnion Support children in Calcutta: http://www.calcutta-espoir.ch |
|
|
|
#8 |
|
Posts: n/a
|
Laurent Bugnion, GalaSoft wrote:
> Hi, > > Göran Andersson wrote: >> <title><asp:Literal id="asdf" runat="server"/></title> >> >> asdf.Text = "First page"; > > I prefer this way: > > <title runat="server" id="pageTitle">Default title</title> > > and then: > > HtmlGenericControl windowTitle > = FindControl( "title" ) as HtmlGenericControl; > > if( windowTitle == null ) > throw new ApplicationException( "..." ); > > windowTitle.InnerHtml = "My title"; > > HTH > Laurent Doesn't the FindControl use the id rather than the tag name? Why use FindControl ayway when you can reference the control directly? |
|
|
|
#9 |
|
Posts: n/a
|
Hi,
Göran Andersson wrote: > Laurent Bugnion, GalaSoft wrote: > >> <title runat="server" id="pageTitle">Default title</title> >> >> and then: >> >> HtmlGenericControl windowTitle >> = FindControl( "title" ) as HtmlGenericControl; >> >> if( windowTitle == null ) >> throw new ApplicationException( "..." ); >> >> windowTitle.InnerHtml = "My title"; > > Doesn't the FindControl use the id rather than the tag name? Sorry, it was a typo. This should read HtmlGenericControl windowTitle = FindControl( "pageTitle" ) as HtmlGenericControl; > Why use FindControl ayway when you can reference the control directly? That's correct. Laurent -- Laurent Bugnion, GalaSoft Software engineering: http://www.galasoft-LB.ch Private/Malaysia: http://mypage.bluewin.ch/lbugnion Support children in Calcutta: http://www.calcutta-espoir.ch |
|