473,763 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing document.title

Is it possible to change the document's title property from code behind (c#) ?
I need to build a dynamic title at runtime.
Nov 18 '05 #1
5 1589
Carlo Marchesoni wrote:
Is it possible to change the document's title property from code behind (c#) ?
I need to build a dynamic title at runtime.

Yes you can run any tag at the server end to turn it into an Html
Generic control:

<title id="theTitle" runat="server">

Then in your code behind you declare the title has an HtmlGenericCont rol
(?) and you can then do:

theTitle.Text= "my title";

I notice you posted that question 3 times... Be patient when posting to
news groups. It can take half an hour or more for your message to appear
in your mail client.

Nick...
Nov 18 '05 #2
I declared runat=server and inserted this declaration:
protected System.Web.UI.H tmlControls.Htm lGenericControl AV0010Title;

in my code behind, but there is no "Text" attribute for this at all. Which property do I have to set in order to see the Title Text.

PS: I posted three times since the Newsgroup reported an error - I don't know why.

"Nick Gilbert" wrote:
Carlo Marchesoni wrote:
Is it possible to change the document's title property from code behind (c#) ?
I need to build a dynamic title at runtime.

Yes you can run any tag at the server end to turn it into an Html
Generic control:

<title id="theTitle" runat="server">

Then in your code behind you declare the title has an HtmlGenericCont rol
(?) and you can then do:

theTitle.Text= "my title";

I notice you posted that question 3 times... Be patient when posting to
news groups. It can take half an hour or more for your message to appear
in your mail client.

Nick...

Nov 18 '05 #3
> I declared runat=server and inserted this declaration:
protected System.Web.UI.H tmlControls.Htm lGenericControl AV0010Title;

in my code behind, but there is no "Text" attribute for this at all. Which property do I have to set in order to see the Title Text.


Sorry - you need to use the "InnerText" property:

protected System.Web.UI.H tmlControls.Htm lGenericControl theTitle;
private void Page_Load(objec t sender, System.EventArg s e) {
theTitle.InnerT ext="foo";
}

Nick...
Nov 18 '05 #4
hi, Carlo,

my way is use Literal Control, you can put the following line inside the
<head></head>:
<title><asp:Lit eral id="ltTitle" runat="server"/></title>

then you can set it in your Page_load or other handler, using Text
attribute.

anyway, you should declare one relevant object in your codebehind file.

Hope it' useful to you.
I declared runat=server and inserted this declaration:
protected System.Web.UI.H tmlControls.Htm lGenericControl AV0010Title;

in my code behind, but there is no "Text" attribute for this at all. Which property do I have to set in order to see the Title Text.
PS: I posted three times since the Newsgroup reported an error - I don't know why.
"Nick Gilbert" wrote:
Carlo Marchesoni wrote:
Is it possible to change the document's title property from code behind (c#) ? I need to build a dynamic title at runtime.

Yes you can run any tag at the server end to turn it into an Html
Generic control:

<title id="theTitle" runat="server">

Then in your code behind you declare the title has an HtmlGenericCont rol
(?) and you can then do:

theTitle.Text= "my title";

I notice you posted that question 3 times... Be patient when posting to
news groups. It can take half an hour or more for your message to appear
in your mail client.

Nick...

Nov 18 '05 #5
BTW, if you use <title> , you should use InnerHtml instead of Text.

That is, AV0010Title.Inn erHtml = "what you dynamically assign";
I declared runat=server and inserted this declaration:
protected System.Web.UI.H tmlControls.Htm lGenericControl AV0010Title;

in my code behind, but there is no "Text" attribute for this at all. Which property do I have to set in order to see the Title Text.
PS: I posted three times since the Newsgroup reported an error - I don't know why.
"Nick Gilbert" wrote:
Carlo Marchesoni wrote:
Is it possible to change the document's title property from code behind (c#) ? I need to build a dynamic title at runtime.

Yes you can run any tag at the server end to turn it into an Html
Generic control:

<title id="theTitle" runat="server">

Then in your code behind you declare the title has an HtmlGenericCont rol
(?) and you can then do:

theTitle.Text= "my title";

I notice you posted that question 3 times... Be patient when posting to
news groups. It can take half an hour or more for your message to appear
in your mail client.

Nick...

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
16215
by: Kenny | last post by:
I have been trying to write a script that will increase the size of and image when you mouse over it, and decrease it to original size, when you mouse out. After a couple of attempts, this is what I've come up with. In this example, there are 5 images (0 thru 4) all with a height of 80px. When you mouse over an image, it changes the growingImage variable equal to the number of the image you mouse over, when you mouse out, it sets it to 5,...
7
6594
by: Frostillicus | last post by:
Hi, I've written some javascript to randomly choose a classical music composer's picture and sample audio and display it on my home page (http://marc.fearby.com/), and this works fine in Mozilla but has problems in IE. Here's the code: imagestring = "<img src=\"" + imagedir + composers + "\" />"; objimage.innerHTML = imagestring;
31
4158
by: Greg Scharlemann | last post by:
Given some recent success on a simple form validation (mainly due to the kind folks in this forum), I've tried to tackle something a bit more difficult. I'm pulling data down from a database and populating a simple table. I'd like the table to contain 10 entries per page and have the option for the user to scroll through the pages of data without having to go back to refresh the page (I've already pulled all the info I need from the...
2
1950
by: Nathan Sokalski | last post by:
I would like to change the <title></title> of a page from a user control. I have been unable to find any property in VB that allows me to do this. The only thing I have been able to find that might be related is when in Design view, there is a property called title under the DOCUMENT object in properties, which leads me to believe that there may be a way to access a DOCUMENT.title somewhere (although that may be only for...
12
4552
by: GaryDean | last post by:
In the original post I failed so indicate that I am using framework 1.1....... I need to be able to change the background color of a page from code. I found an answer to this question in another forum from Peter Huang that said that an id="bg" as follows... <body MS_POSITIONING="GridLayout" runat="server" id="bg"> then we could do the following in our codebehind file....
1
4532
by: rbinington | last post by:
Hi, I am trying to write a DNN module that has the ability to insert articles into an article repository. I want the users to be able to move pages around and enter text into the FCKEditor. I want only one instance of the FCKEditor on the screen at one time so I make tabs that the user can click and I store the values in variables behind the scenes. I change the CSS class on the link that is the currently selected one. I have a really...
2
8387
by: prash.marne | last post by:
hi guys, i have simple problem with my pop up window my code is .... <html> <head> <script type="text/javascript> function open_window(){ window.open("","","channelmode=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,height=100,width=100"); }
3
7357
by: bulldog8 | last post by:
I am having problems with changing a frames source file for Mozilla (1.5.0.4). The followig code works for IE: <script type="text/javascript"> var imgP = new Image(); function ShowPic(ShowThis, wdth, hght) { imgP.src = "../pics/' + ShowThis + '" xw = 500; yh = 500*(hght/wdth); window.document.getElementById("graphic").innerHTML = '<img src="../
7
3647
by: petethebloke | last post by:
Can anyone help? I have a client who has made a "dynamic interactive map" of our city using Dreamweaver. Each map file has hotspots that pop-up a div with a little image when the mouse goes over them. They also link to another file. I've converting the application to a PHP-AJAX system at http://www.ilex-urc-maps.com/testing.html but I can't get the dynamically altered hotspots to work. Any ideas? Please don't tell me that the client...
4
3356
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters the comments and clicks the save button then the date and the date will be stored in the mysql database. This is working fine. But my problem is when, after the user had made an entry the date in the calendar for which an entry has made should be...
0
9566
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9389
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10003
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9828
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7370
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5271
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3918
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2797
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.