|
 |
aspx_beginners thread: Dynamically Changing the Title
Message #1 by "Hugh McLaughlin" <hugh@k...> on Fri, 7 Dec 2001 21:53:47
|
|
Hello Everyone and thanks for your help in advance. Could someone please
give me an example of how to dynamicaly assign the contents of the <title>
attribut using ASP.Net? Thanks.
Message #2 by "Mitch Denny" <mitch.denny@w...> on Sat, 8 Dec 2001 13:52:26 +1100
|
|
Hugh,
You can actually place a literal control in between
the title elements, for example:
<%@ Page Language="c#" Debug="true" %>
<html>
<head>
<title><asp:Literal id="Title" runAt="server"/></title>
<script language="C#" runAt="server">
public void Page_Load(object sender, EventArgs
e) {
this.Title.Text = "Hello World!";
}
</script>
</head>
<body>
<form runat="server">
</form>
</body>
</html>
Note that you could do this as code-behind too, which
is probably the better way to go, but the above is easy
to upload and test. All you have to do is ensure that
the control with the id="Title" is in the code-behind
class as well.
Hope this helps.
----------------------------------------
- Mitch Denny
- http://www.warbyte.com
- mitch.denny@w...
- +61 (414) 610-141
-
> -----Original Message-----
> From: Hugh McLaughlin [mailto:hugh@k...]
> Sent: Friday, 7 December 2001 9:54 PM
> To: aspx_beginners
> Subject: [aspx_beginners] Dynamically Changing the Title
>
>
> Hello Everyone and thanks for your help in advance. Could
> someone please
> give me an example of how to dynamicaly assign the contents
> of the <title>
> attribut using ASP.Net? Thanks.
> $subst('Email.Unsub').
>
Message #3 by "Hugh McLaughlin" <hugh@k...> on Sat, 8 Dec 2001 03:58:01
|
|
> Hugh,
>
> You can actually place a literal control in between
> the title elements, for example:
>
> <%@ Page Language="c#" Debug="true" %>
> <html>
> <head>
> <title><asp:Literal id="Title" runAt="server"/></title>
> <script language="C#" runAt="server">
>
> public void Page_Load(object sender, EventArgs
> e) {
>
> this.Title.Text = "Hello World!";
>
> }
>
> </script>
> </head>
> <body>
> <form runat="server">
> </form>
> </body>
> </html>
>
> Note that you could do this as code-behind too, which
> is probably the better way to go, but the above is easy
> to upload and test. All you have to do is ensure that
> the control with the id="Title" is in the code-behind
> class as well.
>
> Hope this helps.
>
> ----------------------------------------
> - Mitch Denny
> - http://www.warbyte.com
> - mitch.denny@w...
> - +61 (414) 610-141
> -
>
> > -----Original Message-----
> > From: Hugh McLaughlin [mailto:hugh@k...]
> > Sent: Friday, 7 December 2001 9:54 PM
> > To: aspx_beginners
> > Subject: [aspx_beginners] Dynamically Changing the Title
> >
> >
> > Hello Everyone and thanks for your help in advance. Could
> > someone please
> > give me an example of how to dynamicaly assign the contents
> > of the <title>
> > attribut using ASP.Net? Thanks.
> > $subst('Email.Unsub').
> >
>
Worked like a charm. Thanks a lot.
|
|
 |