[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Putting Label Control in Title Tags

Posted on 2004-08-19
14
Medium Priority
?
275 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
Industry Leaders: 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 1000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

650 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