Joseph,

Does ASP.NET not expose the actual page as an object?

I believe it is simply called "Page".

You could do something like:


Sub Page_Load

        Dim oControl as LiteralControl

        For Each oControl In Page.Controls

                If (UCase(Left(oControl.Text, 7)) = "<TITLE>") Then

                        Rem //Parse the title out of the <TITLE></TITLE> tags here.

                End If

        Next

End Sub


HTH

- Mat


-----Original Message-----
From: Joseph E Shook [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 02, 2002 4:27 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Extracting the Title of a Page from CodeBehind?


That is a nice solution.  It works.  But Visual Studio removes the runat
attribute when switching between HTML and Design view.

Also I would still like to extract the title from codebehind without
having to add attributes.  I could just put a constant in each page but
this has turned into a personal exercise in technology.

-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of
Patten, Dave
Sent: Thursday, May 02, 2002 12:59 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Extracting the Title of a Page from CodeBehind?

Html:

<title id="PageTitle" runat="server">Page Title</title>

Code Behind:

protected HtmlGenericControl PageTitle;
private void Page_Load(object sender, System.EventArgs e)
{
        // get or set
        PageTitle.InnerText = "New Title";
}


-----Original Message-----
From: Joseph E Shook [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 02, 2002 12:55 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET] Extracting the Title of a Page from CodeBehind?


Does anyone have a clever way of extracting the title of a page in the
codebehind?



I am talking about the tile that is resident in the following html tags:



<HTML>

<HEAD>

            <title>Page Title</title>

</HEAD>



<body>



</body>

</HTML>

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to