In HTML page, I put:
<html>
<head>
<title>Article: <asp:Label ID="lblHTMLTitle"></asp:Label> </title>
....
In the code behind:
....
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents lblHTMLTitle As System.Web.UI.WebControls.Label
....
cmdSQL = New SqlCommand(sSQL, connADO)
connADO.Open()
cmdReader = cmdSQL.ExecuteReader
If cmdReader.Read() Then
lblHTMLTitle.Text = cmdReader.Item("Title").ToString()
...
.....
But each time it hits: lblHTMLTitle.Text =
cmdReader.Item("Title").ToString(), it gives me the following error message:
Object reference not set to an instance of an object.
Any ideas why is this happening?
Or can't <asp:label> put in <title> tag? 8 3946
instead of using label in <title>
set the title as
<title id=myPageTitle>
in code behind..
System.Web.UI.HtmlGenericControl myPageTitle;
in page load
if(!Page.IsPostBack)
{
myPageTitle.InnerText = "My Page title is dynamic";
}
try something like this....
--
Regards,
HD
"DC" <nemo_HATE_SPAM@computermail_FREESPAM.net> wrote in message
news:Om**************@tk2msftngp13.phx.gbl... In HTML page, I put:
<html> <head> <title>Article: <asp:Label ID="lblHTMLTitle"></asp:Label> </title> ...
In the code behind:
... #Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents lblHTMLTitle As System.Web.UI.WebControls.Label ... cmdSQL = New SqlCommand(sSQL, connADO) connADO.Open() cmdReader = cmdSQL.ExecuteReader If cmdReader.Read() Then lblHTMLTitle.Text = cmdReader.Item("Title").ToString() ... ....
But each time it hits: lblHTMLTitle.Text = cmdReader.Item("Title").ToString(), it gives me the following error
message: Object reference not set to an instance of an object.
Any ideas why is this happening?
Or can't <asp:label> put in <title> tag?
You can get/set the page title through code by adding the runat="server"
attribute to your title tag.
Here's a good example: http://www.aspalliance.com/kenc/faq5.aspx
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://Steve.Orr.net
"DC" <nemo_HATE_SPAM@computermail_FREESPAM.net> wrote in message
news:Om**************@tk2msftngp13.phx.gbl... In HTML page, I put:
<html> <head> <title>Article: <asp:Label ID="lblHTMLTitle"></asp:Label> </title> ...
In the code behind:
... #Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents lblHTMLTitle As System.Web.UI.WebControls.Label ... cmdSQL = New SqlCommand(sSQL, connADO) connADO.Open() cmdReader = cmdSQL.ExecuteReader If cmdReader.Read() Then lblHTMLTitle.Text = cmdReader.Item("Title").ToString() ... ....
But each time it hits: lblHTMLTitle.Text = cmdReader.Item("Title").ToString(), it gives me the following error
message: Object reference not set to an instance of an object.
Any ideas why is this happening?
Or can't <asp:label> put in <title> tag?
Hermit Dave wrote: instead of using label in <title> set the title as <title id=myPageTitle>
in code behind.. System.Web.UI.HtmlGenericControl myPageTitle;
in page load if(!Page.IsPostBack) { myPageTitle.InnerText = "My Page title is dynamic"; }
try something like this....
Don't forget that the <title> tag needs a runat="server" attribute:
<title id="myPageTitle" runat="server">
--
mikeb
oh shite.. forgot that... sorry... was about to leave for home then...
--
Regards,
HD
Once a Geek.... Always a Geek
"mikeb" <ma************@mailnull.com> wrote in message
news:%2*****************@tk2msftngp13.phx.gbl... Hermit Dave wrote: instead of using label in <title> set the title as <title id=myPageTitle>
in code behind.. System.Web.UI.HtmlGenericControl myPageTitle;
in page load if(!Page.IsPostBack) { myPageTitle.InnerText = "My Page title is dynamic"; }
try something like this....
Don't forget that the <title> tag needs a runat="server" attribute:
<title id="myPageTitle" runat="server">
-- mikeb
I dont know about anyone else..but it seems like VS.Net always removed my
runat="server" attribute on my title tag...I've stopped doing it that way
and use a placeholder now instead...
Chad Mccune, MCSE, MCDBA
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eb**************@TK2MSFTNGP12.phx.gbl... You can get/set the page title through code by adding the runat="server" attribute to your title tag. Here's a good example: http://www.aspalliance.com/kenc/faq5.aspx
-- I hope this helps, Steve C. Orr, MCSD, MVP http://Steve.Orr.net
"DC" <nemo_HATE_SPAM@computermail_FREESPAM.net> wrote in message news:Om**************@tk2msftngp13.phx.gbl... In HTML page, I put:
<html> <head> <title>Article: <asp:Label ID="lblHTMLTitle"></asp:Label> </title> ...
In the code behind:
... #Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents lblHTMLTitle As System.Web.UI.WebControls.Label ... cmdSQL = New SqlCommand(sSQL, connADO) connADO.Open() cmdReader = cmdSQL.ExecuteReader If cmdReader.Read() Then lblHTMLTitle.Text = cmdReader.Item("Title").ToString() ... ....
But each time it hits: lblHTMLTitle.Text = cmdReader.Item("Title").ToString(), it gives me the following error message: Object reference not set to an instance of an object.
Any ideas why is this happening?
Or can't <asp:label> put in <title> tag?
Thanks. How about changing meta content?
Can it be done from server side as well?
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eb****************@TK2MSFTNGP12.phx.gbl... You can get/set the page title through code by adding the runat="server" attribute to your title tag. Here's a good example: http://www.aspalliance.com/kenc/faq5.aspx
-- I hope this helps, Steve C. Orr, MCSD, MVP http://Steve.Orr.net
"DC" <nemo_HATE_SPAM@computermail_FREESPAM.net> wrote in message news:Om**************@tk2msftngp13.phx.gbl... In HTML page, I put:
<html> <head> <title>Article: <asp:Label ID="lblHTMLTitle"></asp:Label> </title> ...
In the code behind:
... #Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents lblHTMLTitle As System.Web.UI.WebControls.Label ... cmdSQL = New SqlCommand(sSQL, connADO) connADO.Open() cmdReader = cmdSQL.ExecuteReader If cmdReader.Read() Then lblHTMLTitle.Text = cmdReader.Item("Title").ToString() ... ....
But each time it hits: lblHTMLTitle.Text = cmdReader.Item("Title").ToString(), it gives me the following error message: Object reference not set to an instance of an object.
Any ideas why is this happening?
Or can't <asp:label> put in <title> tag?
sorry mate was in a bit of hurry... my bad..
thanks for correcting...
--
Regards,
HD
Once a Geek.... Always a Geek
"mikeb" <ma************@mailnull.com> wrote in message
news:%2*****************@tk2msftngp13.phx.gbl... Hermit Dave wrote: instead of using label in <title> set the title as <title id=myPageTitle>
in code behind.. System.Web.UI.HtmlGenericControl myPageTitle;
in page load if(!Page.IsPostBack) { myPageTitle.InnerText = "My Page title is dynamic"; }
try something like this....
Don't forget that the <title> tag needs a runat="server" attribute:
<title id="myPageTitle" runat="server">
-- mikeb
yep , same here , a real pita , have to reinsert the runat="server" anytime
the page ( code behind I believe ? ) is edited and saved.
"Chad McCune" <mccuneca@_NOSPAM_fpwk.com> wrote in message
news:ua**************@TK2MSFTNGP10.phx.gbl... I dont know about anyone else..but it seems like VS.Net always removed my runat="server" attribute on my title tag...I've stopped doing it that way and use a placeholder now instead...
Chad Mccune, MCSE, MCDBA
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message news:eb**************@TK2MSFTNGP12.phx.gbl... You can get/set the page title through code by adding the runat="server" attribute to your title tag. Here's a good example: http://www.aspalliance.com/kenc/faq5.aspx
-- I hope this helps, Steve C. Orr, MCSD, MVP http://Steve.Orr.net
"DC" <nemo_HATE_SPAM@computermail_FREESPAM.net> wrote in message news:Om**************@tk2msftngp13.phx.gbl... In HTML page, I put:
<html> <head> <title>Article: <asp:Label ID="lblHTMLTitle"></asp:Label> </title> ...
In the code behind:
... #Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents lblHTMLTitle As
System.Web.UI.WebControls.Label ... cmdSQL = New SqlCommand(sSQL, connADO) connADO.Open() cmdReader = cmdSQL.ExecuteReader If cmdReader.Read() Then lblHTMLTitle.Text = cmdReader.Item("Title").ToString() ... ....
But each time it hits: lblHTMLTitle.Text = cmdReader.Item("Title").ToString(), it gives me the following error message: Object reference not set to an instance of an object.
Any ideas why is this happening?
Or can't <asp:label> put in <title> tag?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: mark |
last post by:
IF I have something like this:
<title><?php print($pagetitle); ?></title>
<body>
<?php include("folders/my_include.php"); ?>
</body>
</html>
and my_include.php contains the value to the...
|
by: Info 3000 |
last post by:
Hi there,
Simple question, but headache !
I have a PHP Page like :
<HTML>
<HEAD>
<TITLE>Sunny day !</TITLE>
</HEAD>
|
by: D. Alvarado |
last post by:
Hello,
I am trying to find the <TITLE> element of my document. Normally
alert(document.title);
works just fine, but when this statement is within a page that is a
frame in a larger document,...
|
by: Irene |
last post by:
Hi,
I would like to modify the text within an html title tag based upon a
value read from the registry (or the existence of a certain file).
For example, if a certain registry value is equal...
|
by: Andreas Klemt |
last post by:
Hello,
I have in my strHtml a html page.
so what is the fastest way (with XML Read?) to get the "myValue" between
<title>myValue</title>
Thanks,
Andreas
|
by: Alex |
last post by:
Hi,
is it possible to set the title programatically from the code behind page.
I placed a literal in the head section of the form and set its text
property.
it seemed to work bu the literal...
|
by: Carlo Marchesoni |
last post by:
Is it possible to change the document's title property from code behind (c#) ?
I need to build a dynamic title at runtime.
|
by: David Thielen |
last post by:
Hi;
If I am using master pages, how do I set the <title> and <meta
name='description' content='my title'> for each page. Obviously each page
will have a different title & description.
--...
|
by: Steve B |
last post by:
Is there a way to manipulate the <TITLEin the csharp code?
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |