473,398 Members | 2,212 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,398 software developers and data experts.

How to add <base target="_self"> in code behind

Hi!

I want to add
<base target="_self">
into the header section of a aspx page. I want to do this in the code
behind because I use master pages which I do not want to change directly.

Thanks

Joe
May 3 '07 #1
5 19913
"Joe Kovac" <Jo****@nospam.comwrote in message
news:e2***************************@news.inode.at.. .
I want to add
<base target="_self">
into the header section of a aspx page. I want to do this in the code
behind because I use master pages which I do not want to change directly.
http://msdn2.microsoft.com/en-us/lib....htmlhead.aspx
--
http://www.markrae.net

May 3 '07 #2
Another option:

Have a protected class-level string variable (and assign a value in
Page_Load or inline) in the code-behind:

protected string baseUrl = "<base href=\"_self\">";

And in the .aspx page:

<head>
<%= baseUrl %>
</head>

"Joe Kovac" wrote:
Hi!

I want to add
<base target="_self">
into the header section of a aspx page. I want to do this in the code
behind because I use master pages which I do not want to change directly.

Thanks

Joe
May 3 '07 #3
"Siva M" <sh******@online.excite.comwrote in message
news:C2**********************************@microsof t.com...
protected string baseUrl = "<base href=\"_self\">";
protected string baseUrl = "<base target=\"_self\">";
And in the .aspx page:
In the MasterPage...

--
http://www.markrae.net

May 3 '07 #4
Mark Rae wrote:
"Siva M" <sh******@online.excite.comwrote in message
news:C2**********************************@microsof t.com...
>protected string baseUrl = "<base href=\"_self\">";

protected string baseUrl = "<base target=\"_self\">";
>And in the .aspx page:

In the MasterPage...
Well, I don't want this in the MasterPage as not all pages are
concerned. Therefor I use:

Page.Header.Controls.Add(new LiteralControl(@"<base target=""_self"" />"));

May 4 '07 #5
"Joe Kovac" <Jo****@nospam.comwrote in message
news:a3**************************@news.inode.at...
Mark Rae wrote:
>"Siva M" <sh******@online.excite.comwrote in message
news:C2**********************************@microso ft.com...
>>protected string baseUrl = "<base href=\"_self\">";

protected string baseUrl = "<base target=\"_self\">";
>>And in the .aspx page:

In the MasterPage...

Well, I don't want this in the MasterPage as not all pages are concerned.
Therefor I use:

Page.Header.Controls.Add(new LiteralControl(@"<base target=""_self""
/>"));

Indeed - what I meant was that such things need to end up in the header
section and, since content pages don't have headers...

No biggie...
--
http://www.markrae.net

May 4 '07 #6

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

Similar topics

0
by: |-|erc | last post by:
<?php // Get the names and values for vars sent by index.lib.php3 if (isset($HTTP_GET_VARS)) { while(list($name,$value) = each($HTTP_GET_VARS)) { $$name = $value; }; };
3
by: Lars Schlanbusch | last post by:
Hi! Is there any way to set <base target="_blank"> for links which link to a page outside the domain, and <base target="_self"> for links which link to a page inside the domain? Can i do such...
4
by: John MacIntyre | last post by:
Hi, Using the script below, when you click on the radio button beside click here .... the first row shrinks. Has anybody else ever experienced this? Does anybody know of a logical...
2
by: Rez | last post by:
Hi Guys, I have a problem with exporting to excel from a modal dialog box. Basically, i have an ASPX page that gathers user criteria, and passes it to a dialogbox (showModalDialog), There is a...
7
by: Jack Gray | last post by:
I have a form requiring data input for all fields. When any field is left blank and the data is submitted, the cgi file generates a new form which is populated with data already input and an error...
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: 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?
0
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...
0
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,...
0
Oralloy
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.