473,379 Members | 1,533 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Literals

Hi,

I am just transfering to asp.net from classic asp. I wish to write out a
"<base href=' & servername & '>" dynaically in the head section of the
form.
I though at first a lieral would do the trick and that i could just set the
text of the lieral (which server I am running on) in the page load event.

however I found that I can't place a lieral in the head in the forms
designer of visual studio and even if I could I guess that I would have to
make the <form> elemants of asp.net surround the literal.

does any body please have a solution to my problem.

any help is appreciated.

cheers

martin.
Nov 17 '05 #1
1 1325
Thank you all.
"CT" <ca******@spammersgoawaydotnetservices.biz> wrote in message
news:O2**************@TK2MSFTNGP09.phx.gbl...
Hmm, not sure if this will do it for you, but here it goes:

This bit goes in between the head start and end tags:

<base id="serverNameLiteral" href="" runat="server" />

This declaration goes in the class in your code behind file:

protected System.Web.UI.HtmlControls.HtmlGenericControl serverNameLiteral;

This bit goes in the Page_Load event handler in your code behind file:

foreach (System.Web.UI.Control ParentControl in this.Page.Controls)
{
if (ParentControl.GetType().ToString() ==
"System.Web.UI.HtmlControls.HtmlGenericControl ")
{
if (ParentControl.ID == "serverNameLiteral")
{
serverNameLiteral.Attributes["HREF"] = servername;
}
}
}

I'm sure it can be done much neater, but it might be what you're after.
--
Carsten Thomsen
http://www.apress.com/book/bookDisplay.html?bID=105
<ca***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,

I am just transfering to asp.net from classic asp. I wish to write out
a
"<base href=' & servername & '>" dynaically in the head section of the
form.
I though at first a lieral would do the trick and that i could just set

the
text of the lieral (which server I am running on) in the page load

event.
however I found that I can't place a lieral in the head in the forms
designer of visual studio and even if I could I guess that I would have to make the <form> elemants of asp.net surround the literal.

does any body please have a solution to my problem.

any help is appreciated.

cheers

martin.


Nov 17 '05 #2

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

Similar topics

6
by: nico | last post by:
In my python scripts, I use a lot of accented characters as I work in french. In order to do this, I put the line # -*- coding: UTF-8 -*- at the beginning of the script file. Then, when I need...
17
by: Janice | last post by:
char* line = "abcd"; How to convert the line to upper case and print? Any option for printf to do this? Thanx
0
by: Robin Tucker | last post by:
I'm localizing and need to find all string literals in my source code. I don't want to find any of the literals that will end up in resources however. As I don't use the "Me" keyword, I know...
6
by: copx | last post by:
Can you / are you supposed to free() string literals which are no longer needed? In my case I've menu construction code that looks like this: menu_items = list_new(); list_add(menu_items,...
4
by: Tyler Durden | last post by:
Hi: Just wondering if anyone can point me at some documentation for specifying literals with type in C#. I have searched for this a couple of times with no luck (found the VB.NET equivalent)....
15
by: George Sakkis | last post by:
Although I consider dict(**kwds) as one of the few unfortunate design choices in python since it prevents the future addition of useful keyword arguments (e.g a default value or an orderby...
5
by: bradeck | last post by:
A question recently came up of late in some interviewing techniques discussions and I vaguely remember this being an ANSI C++ related issue but cannot remember the specifics. Basically if you have...
27
by: SasQ | last post by:
Hello. I wonder if literal constants are objects, or they're only "naked" values not contained in any object? I have read that literal constants may not to be allocated by the compiler. If the...
25
by: Lennart Benschop | last post by:
Python has had the Decimal data type for some time now. The Decimal data type is ideal for financial calculations. Using this data type would be more intuitive to computer novices than float as its...
7
by: lithiumcat | last post by:
Hi, I'm not yet very confident in my use of standard terminology, so please be kind if I'm mis-calling something, I will do my best no to make it again once pointed out. I'm wondering what is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.