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
Solved

Putting Label Control in Title Tags

Posted on 2004-08-19
14
271 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
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:

840 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