473,387 Members | 1,678 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,387 software developers and data experts.

Write to HTML Tag?


I need to write an XML namespace declaration in my HTML tag. It must
be done in the code-behind for the page, I can't edit the .aspx
template directly.

I need to turn this:

<HTML>

into this:

<HTML XMLNS:MyNewSpace>
I have already added "id" and "runat" attributes to the <html> tag,
but now I need to address it and get text inside.

Thanks.

Nov 18 '05 #1
3 1826
This might get you started:

<%@ Page language="c#" AutoEventWireup="false" Trace="false" %>
<!doctype html public "-//w3c/dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html lang="en" id="HTML" runat="server">
<head>
<script language="C#" runat="server">
protected override void OnLoad(EventArgs e)
{
HTML.Attributes["xmlns:foobar"] = "http://foobar.org/";
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="GENERATOR" content="Microsoft Visual Studio 7.0" />
<meta name="CODE_LANGUAGE" content="C#" />
</head>
<body>
<form id="Form1" method="post" runat="server">
Hello world
</form>
</body>
</html>

"localhost" <pr*******@cohort.ces> wrote in message news:he********************************@4ax.com...

I need to write an XML namespace declaration in my HTML tag. It must
be done in the code-behind for the page, I can't edit the .aspx
template directly.

I need to turn this:

<HTML>

into this:

<HTML XMLNS:MyNewSpace>
I have already added "id" and "runat" attributes to the <html> tag,
but now I need to address it and get text inside.

Thanks.

Nov 18 '05 #2
Hi Localhost,

As for the question on add custom attributes into the <HTML> tag, I think
Scott 's suggestions i reasonable.
If you are using codebehind for your asp.net web page, in addition to add
the "id" and "runat" attrributes , you also need to declare a
HtmlGenericControl page member to map the <Html> tag, after that, you can
reference the <html> in your code, just as below:

<HTML id="MyHtml" runat="server">
<HEAD>

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

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
MyHtml.Attributes.Add("XMLNS","HTTP://LEARN");
}
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Nov 18 '05 #3
"localhost" <pr*******@cohort.ces> wrote in message
news:he********************************@4ax.com...

I need to write an XML namespace declaration in my HTML tag. It must
be done in the code-behind for the page, I can't edit the .aspx
template directly.

I need to turn this:

<HTML>

into this:

<HTML XMLNS:MyNewSpace>
I have already added "id" and "runat" attributes to the <html> tag,
but now I need to address it and get text inside.


Sorry, you can't do this without touching the .aspx page. It would need to
have:

<HTML runat="server" id="myHtmlTag">

Only HTML elements marked with runat="server" have any existence on the
server.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #4

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

Similar topics

6
by: Mike Daniel | last post by:
I am attempting to use document.write(pageVar) that displays a new html page within a pop-up window and the popup is failing. Also note that pageVar is a complete HTML page containing other java...
4
by: Ray Schaeffer | last post by:
Hi, I've written a very simple test HTML/JS program where the JS code in one frame writes to a different frame with "parent.frame1.document.write(...". This seems to work ok with IE-6, but with...
4
by: Geoff Wilkins | last post by:
I must confess I only come here when I have a problem - so my apologies if this has been raised before: Using my IE v.6 browser, document.write doesn't convert HTML entities (e.g. &apos;, &amp;) to...
2
by: Brett Baisley | last post by:
Hello I have a block of html code that I want to run by calling a javascript function to print it. Its basically a table with menu items in it that is the same for many pages, and instead of...
6
by: ok | last post by:
<img src="http://www.6park.com/enter2/av.gif" onload="document.write('an iframe obj');"> First of all, it destroy the HTML page. Secondly even if it does not destroy it, the iframe object will...
14
by: Eli | last post by:
I've got a script that I'm trying to debug which uses document.write() to place HTML within a page. In both IE6 and Firefox when I view source, I see only the script itself and not any HTML as...
4
by: Prowler | last post by:
In the application we are currently building, we need to write positioning code on-the-fly, based upon the screen offset of the element in the AS/400 application which drives the Web app. The 400,...
8
by: '69 Camaro | last post by:
Perhaps I'm Googling for the wrong terms. Does anyone have links to examples of the syntax necessary to read the HTML on another Web page when that HTML is produced from JavaScript using the...
11
by: Michael Powe | last post by:
How can I make an XHTML-compliant form of an expression in this format: document.write("<scr"+"ipt type='text/javascript' src='path/to/file.js'>"+"</scr"+"ipt>"); this turns out to be a...
0
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,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.