Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > I want html, not xhtml from my aspnet controls

Reply
Thread Tools

I want html, not xhtml from my aspnet controls

 
 
j.madgwick@wiganmbc.gov.uk
Guest
Posts: n/a
 
      01-03-2007
I'm confused. I've been trawling the web and can't find the
answer...

The background: I am working on a MCMS site with ASPNET 1.1.4322. We
want the site to be written in standard compliant HTML that passes the
W3C validator.

The problem: ASPNET controls are generating HTML with xHTML
self-closing tags. Eg. <img id="Image1" alt="" border="0" /> and <input
type="hidden" name="__EVENTTARGET" value="" />

A solution: I have read that you can use <xhtmlConformance
mode="Legacy" /> in your web.config to control the type of HTML
generated by an ASPNET control, but this is a feature of ASPNET 2.0, we
are using 1.1.

The confusion: From what I have read on the web, ASPNET 1.1 does *not*
produce any xHTML code. Every article is about getting xHTML not
getting rid of it! So, where are the closing tags coming from? Could
it be part of a Service Pack or other windows/accessibility upgrade? I
mention accessibility because I've noticed that it also puts a empty
alt attribute into my img tags automatically too.

Any information would be appreciated.
Thanks,
John.

 
Reply With Quote
 
 
 
 
Brennan Stehling
Guest
Posts: n/a
 
      01-03-2007
John,

What is your problem exactly? You do not want the empty alt tags or
closing tags?

The empty alt tag is required if you specify a certain DTD for HTML.
That is not just for XHTML. And the self closing tags... <br /> and
<img /> will not cause legacy browsers to display the page incorrectly.
It is not clear that the HTML validators will have a problem with them
either. While this is an XHTML requirement, you may find that this is
encouraged with the HTML 4 specification. You can see the official
recommendation here...

http://www.w3.org/TR/xhtml1/#guidelines

Look at C.2. It explains to ease gradual migration from legacy HTML to
XHTML the BR and IMG tags should include the self-closing feature.
More here...

http://en.wikipedia.org/wiki/HTML#Cu...lavors_of_HTML
http://en.wikipedia.org/wiki/HTML#Tr...XML-based_HTML

I also wrote this last year which you may find useful.

Why not XHTML Strict?
http://brennan.offwhite.net/blog/200...tml-11-strict/

I also suggest keeping an eye on this website...

http://alistapart.com/

Brennan Stehling
http://brennan.offwhite.net/

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I'm confused. I've been trawling the web and can't find the
> answer...
>
> The background: I am working on a MCMS site with ASPNET 1.1.4322. We
> want the site to be written in standard compliant HTML that passes the
> W3C validator.
>
> The problem: ASPNET controls are generating HTML with xHTML
> self-closing tags. Eg. <img id="Image1" alt="" border="0" /> and <input
> type="hidden" name="__EVENTTARGET" value="" />
>
> A solution: I have read that you can use <xhtmlConformance
> mode="Legacy" /> in your web.config to control the type of HTML
> generated by an ASPNET control, but this is a feature of ASPNET 2.0, we
> are using 1.1.
>
> The confusion: From what I have read on the web, ASPNET 1.1 does *not*
> produce any xHTML code. Every article is about getting xHTML not
> getting rid of it! So, where are the closing tags coming from? Could
> it be part of a Service Pack or other windows/accessibility upgrade? I
> mention accessibility because I've noticed that it also puts a empty
> alt attribute into my img tags automatically too.
>
> Any information would be appreciated.
> Thanks,
> John.


 
Reply With Quote
 
 
 
 
j.madgwick@wiganmbc.gov.uk
Guest
Posts: n/a
 
      01-04-2007
Hi Brennan,
Thank-you for your response.
My problem is my version of ASPNET 1.1 is producing xHTML (with
self-closing tags) when I was expecting it to produce HTML (without
self-closing tags).

Originally, we were going to create the site in xHTML 1.0 Transitional,
but we're using Microsoft CMS and can't get the bugger to produce
valid xHTML. Therefore, we decided to go with HTML 4.0 Strict.
Unfortunately, it has left us in a bit of limbo because tags produced
by CMS are HTML and the ASPNET ones are xHTML. So, in the source code
it looks as if we can't decide which one we want to use!

You are right about the validator. It was not the self-closing tags
causing the errors, so I guess this is a bit of a non-issue that I can
live with now, but it is still annoying.

We always use alt tags in our img tags so this was not the problem. I
just mentioned it above because when I was doing some testing I
wasn't expecting ASPNET to drop it in automatically. I thought it
may be a clue towards a Service Pack that may have affected the output
code.

BTW: Nice article.

Thanks again,
John.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is the aspnet account called "aspnet" for all non-English versions of Windows and IIS? torus@tpg.com.au ASP .Net 7 03-23-2007 04:00 AM
parse URL (href) from xhtml, xhtml -> text, for data hawat.thufir@gmail.com XML 7 02-08-2006 07:39 PM
Upgrade from aspnet 1.1 to aspnet 2.0 Gary Nelson ASP .Net 2 10-14-2005 05:16 PM
microsoft.public.dotnet.framework.aspnet.webcontrols ,microsoft.public.dotnet.framework.aspnet Alfred Sehmueller ASP .Net Web Controls 0 02-20-2004 02:39 PM
Restricting ASPNET ACLs without breaking ASPNET (newbie-ish) Brian Schuth ASP .Net Security 0 09-08-2003 06:09 PM



Advertisments