Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataList problem

Status
Not open for further replies.

AlexCuse

Programmer
Apr 13, 2006
5,416
US
Hi Guys,

I'm having a problem displaying certain blog entries on my website (well, they display just fine but don't validate). I'm using a DataList control to display said entries.

THe problem arises when I use certain features within a bbcode parser, namely the code and list features, which use "blockquote" and "ul", respectively. Because the data list uses a "span" element to display the text, said elements are not allowed (doctype is XHTML 1.0 Transitional).

I guess my question is, is there any way I can change this behavior in the DataList, or do I need to create some type of user control that will spit out better HTML?

I've tried to make myself clear, but I am not very web-savvy, so please let me know if I missed anything.

Thanks in advance for any help,

Alex

[small]----signature below----[/small]
I'm pushing an elephant up the stairs

My Crummy Web Page
 
Hey Alex,

You can add to following to your web.config file which will help render some attributes to a better specification:
Code:
	<system.web>
		[!]<xhtmlConformance mode="Strict"/>[/!]
                ...
However, whilst it is good practice, I don't think it will necessarily help in this case.

I think you have two options:

1) Ditch the DataList and use a Repeater. This will be more work but will give you better control over the output.

2) Use a Control Adaptor to alter the output (maybe just changing the span to a div would suffice).




-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
Thanks Mark, seems that you're always the guy to bail me out when I've got a problem with this stuff.

I got it all squared away by using the repeater control, and putting the post contents in a div. The repeater does seem to be a lot more flexible than the DataList, and I'm glad I know how to use it now :)

[small]----signature below----[/small]
I'm pushing an elephant up the stairs

My Crummy Web Page
 
Someone is paying attention ;)

I have not tried that yet but I don't foresee any problems. The paging is handled by a user control, and is mostly done at the database level, so I think that I should be able to plug a repeater in instead of a data list in the user control fairly easily. Hopefully I'll be able to get to it today.

I'll post back to this thread if I run into any problems with that.

Thanks again,

Alex

[small]----signature below----[/small]
I'm pushing an elephant up the stairs

My Crummy Web Page
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top