Solved

Putting Label Control in Title Tags

Posted on 2004-08-19
14
272 Views
Last Modified: 2013-11-19
Can I do this?

<title><asp:Label id="Label1" style="Z-INDEX: 102; LEFT: 280px; POSITION: absolute; TOP: 208px" runat="server"></asp:Label></title>
 (label1's value is set to that of application("Institution") )


If not, then should I do

<title<%=application("Institution")%></title>   ??

Is there a better way to put, say, application variables into the browser page title?
0
Comment
Question by:smetterd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
14 Comments
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11844945
hello again smetterd :)

best way is probalby to give your title an id and runat="server" then refer to its InnerHtml property:

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

in your code

title.InnerHtml = Application("Institution")

-Trevor
0
 
LVL 2

Author Comment

by:smetterd
ID: 11845050
Doesn't seem to work. Displays full path in IE title bar...
0
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11845064
it's working for me on a test page.  it isn't a problem with the code behind again is it?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:smetterd
ID: 11845079
Paste me your code so I can compare...
0
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11845140
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title runat="server" id="title">Untitled Document</title>
</head>
<body>

<script runat="server">
      public void Page_Load(object sender, EventArgs E)
      {
            title.InnerHtml = "hi";
      }
      

</script>

<form runat="server">

</form>
</body>
</html>


check it out at http://www.futureshirts.com/testing/test.aspx
0
 
LVL 2

Author Comment

by:smetterd
ID: 11845352
I am using VB.NET
0
 
LVL 2

Author Comment

by:smetterd
ID: 11845570
What namespace does InnerHtml use?
0
 
LVL 8

Accepted Solution

by:
trevorhartman earned 250 total points
ID: 11845587
its a property of the HtmlContainerControl control.

System.Web.UI.HtmlControls.HtmlContainerControl

it should behave exactly the same for VB.NET
0
 
LVL 2

Author Comment

by:smetterd
ID: 11845592
Parser Error Message: The base class includes the field 'lblTitle', but its type (System.Web.UI.HtmlControls.HtmlSelect) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlGenericControl).

Source Error:


Line 3:  <HTML>
Line 4:        <HEAD>
Line 5:              <title runat="server" id="lblTitle">Untitled Document</title>
Line 6:              <meta name="vs_snapToGrid" content="False">
Line 7:              <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
 
0
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11845617
did you get it resolved?
0
 
LVL 2

Author Comment

by:smetterd
ID: 11845635
Yup... I was using the wrong namespace!!
0
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11845642
ah, i see
0
 
LVL 2

Author Comment

by:smetterd
ID: 11845654
Notice I was using
System.Web.UI.HtmlControls.HtmlGenericControl

I changed it to
System.Web.UI.HtmlControls.HtmlContainerControl

and Voila!

Thanks dude
0
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11845665
any time
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question