Solved

Putting Label Control in Title Tags

Posted on 2004-08-19
14
268 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
  • 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
 
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to count occurrences of each item in an array.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now