Solved

Putting Label Control in Title Tags

Posted on 2004-08-19
14
273 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
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 
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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
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…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

705 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