<%= TitleTag %>
<%= TitleTag %>
<%= TitleTag %>
<%= TitleTag %>
<%= TitleTag %>
<%= TitleTag %> <%= TitleTag %> <%= TitleTag %> <%= TitleTag %> <%= TitleTag %> <%= TitleTag %> <%= TitleTag %> <%= TitleTag %>
<%= TitleTag %> <%= TitleTag %>
<%= TitleTag %>
Go Back  Xtreme Visual Basic Talk > > > <%= TitleTag %>


Reply
 
Thread Tools Display Modes
  #1  
Old 11-06-2006, 05:47 AM
tonymaclennan tonymaclennan is offline
Contributor
 
Join Date: Sep 2004
Location: Lincolnshire
Posts: 402
Default <%= TitleTag %>


My code:

Code:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="ViewCategory.aspx.vb" Inherits="WebHosting.ViewCategory" %>

<script language="VB" runat="server">

	public TitleTag as string
	Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
		TitleTag=request.querystring("cat")+" Scrpts"
	End Sub
	
	</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title><%= TitleTag %> : DigitalRacks</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
	</HEAD>
	<body MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
			<table>
				<tr>
					<td id="tbl" runat="server"></td>
				</tr>
			</table>
		</form> <!-- #include file="../company/templates/design/footer.htm"-->
	</body>
</HTML>

I want to display the value of the TitleTag variable in the title!

What am I doing wrong?
Reply With Quote
  #2  
Old 11-06-2006, 08:45 AM
wayneph's Avatar
wayneph&lt;%= TitleTag %&gt; wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

1. Don't Use Response.Write (<%= %>). It is a crutch from Classic ASP. I have yet to use it in .NET.

Try the first suggestion from this page: http://www.developer.com/net/asp/article.php/2107811
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #3  
Old 12-03-2006, 07:27 PM
tonymaclennan tonymaclennan is offline
Contributor
 
Join Date: Sep 2004
Location: Lincolnshire
Posts: 402
Default

I added the following after inherets:

Protected PgeTitle As System.Web.UI.HtmlControls.HtmlGenericControl

My Title tag:

<title runat="server" id="PgeTitle"></title>

My title code:

PgeTitle.InnerText = "script"

Error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.


Any body got any ideas?
Reply With Quote
  #4  
Old 12-04-2006, 07:44 AM
wayneph's Avatar
wayneph&lt;%= TitleTag %&gt; wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

OK, here's a slightly different option. (I've actually tested this one in .NET 2003...)

In your Page add the following code for your <title> tag:
HTML Code:
<title><asp:Literal runat="server" id="PageTitle"></asp:Literal></title>
Then in your Declarations add the following line to like the Code Behind to the declaration:
Code:
Protected PageTitle As Literal
And then you can change the Text in your Page_Load Event
Code:
PageTitle.Text = System.DateTime.Now.ToString()
A little work, but it allowed me to set up a dynamic title.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #5  
Old 12-04-2006, 04:47 PM
tonymaclennan tonymaclennan is offline
Contributor
 
Join Date: Sep 2004
Location: Lincolnshire
Posts: 402
Default

I get the same error!
Reply With Quote
  #6  
Old 12-05-2006, 07:06 AM
wayneph's Avatar
wayneph&lt;%= TitleTag %&gt; wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

can you create a test page that is just for the title. Try it, and if it doesn't work paste the .aspx and .aspx.vb files here. I tried the second method, and saw it working. (using .net 2003) If you're using 2005, I think there is actually a Title method built in that will work.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
&lt;%= TitleTag %&gt;
&lt;%= TitleTag %&gt;
&lt;%= TitleTag %&gt; &lt;%= TitleTag %&gt;
&lt;%= TitleTag %&gt;
&lt;%= TitleTag %&gt;
&lt;%= TitleTag %&gt; &lt;%= TitleTag %&gt; &lt;%= TitleTag %&gt; &lt;%= TitleTag %&gt; &lt;%= TitleTag %&gt; &lt;%= TitleTag %&gt; &lt;%= TitleTag %&gt;
&lt;%= TitleTag %&gt;
&lt;%= TitleTag %&gt;
 
&lt;%= TitleTag %&gt;
&lt;%= TitleTag %&gt;
 
-->