Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 21st, 2006, 04:25 PM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default W3C XHTML Validation on ASP:Label control

Hi All

I have just hit an interesting problem... I am using a Masterpage with 2 contentplaceholder controls within it. The content fed into these placeholders can vary and on quite a few pages include <p> and <table> tags.

When trying to XHTML validate theses pages using http://validator.w3.org I can't get passed the following error:

document type does not allow element "table" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag .
One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "").


... What I have noticed is that the contentplaceholders produce <span> tags on the client side which stuff my validation up.

Has anyone found a way to overcome this obstacle? If so it would be great if you could share with all of us.

Warm Regards

Rit
__________________
Rit
www.designandonline.co.uk
INSPIRE | CREATE | DELIVER
 
Old June 22nd, 2006, 08:51 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Rit,

Can you link to, or show us the code for the offending page?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old June 22nd, 2006, 05:12 PM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

Really sorry about this. I rushed into this one too quick.. Its not the contentplaceholder control but rather the Label control which I am using to deliver my data driven content.

It produces Span tags such as:

<span id="ctl00_MainContent_Content_pgContentLabel">MY CONTENT</span>

And according to the W3C error above, I am not allowed <table> or <p> nested within <SPAN> tags.

Is there a better way to deliver content rather than using a asp:Label control?

Many thanks

Rit
 
Old June 22nd, 2006, 05:15 PM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

When done with this string I will rename the title so that it is referring to my real issue rather than my misunderstanding... at least then it may be useful for others similar to me.

Ta

Rit
 
Old June 23rd, 2006, 01:26 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Rit,

Right, I see. Indeed a label shouldn't be used for this kind of content. A label is just that, a piece of text describing or defining something.

I think what you're looking for is the asp:Literal control.

This control behaves more or less the same as the Label, but it doesn't render any markup itself.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old June 26th, 2006, 06:58 AM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

Imar, Once again you are spot on.

A BIG thank you!

Rit
 
Old June 26th, 2006, 12:30 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You're welcome....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004





Similar Threads
Thread Thread Starter Forum Replies Last Post
XHTML Validation nairaby HTML Code Clinic 2 August 11th, 2007 02:45 AM
asp:Label control - 2 problems VictorVictor ASP.NET 2.0 Basics 8 April 14th, 2006 10:14 AM
ASP/ASPX W3C validation URL OldCoder HTML Code Clinic 4 April 8th, 2006 11:58 PM
W3C Validation help!! Mantis HTML Code Clinic 8 April 3rd, 2006 02:04 PM
W3C Validation of FORM steamydave CSS Cascading Style Sheets 2 April 27th, 2005 10:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.