Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > asp.net 1.1 generates spurious whitespace

Reply
Thread Tools

asp.net 1.1 generates spurious whitespace

 
 
ajfish@blueyonder.co.uk
Guest
Posts: n/a
 
      03-13-2007
hi,

I have an asp.net webform that contains some source like this

<img src="..."><asp:hyperlink id=".." runat="server"...>

with no whitespace between the tags. when the page is rendered, it
comes out like this:

<img src="..."> <asp:hyperlink id=".." runat="server"...>

there are 2 tab characters between the end of the img tag and the
hyperlink tag which cause a space to appear where I don't want it in
the HTML.

I have this exact sequence repeated in many places in the application
(several times on the same page) and there are 2 that behave in this
way, but I can't find any rhyme nor reason for it. there is no funny
character in the source file.

anyone else seen this problem? any ideas for a workaround?

Andy

 
Reply With Quote
 
 
 
 
Mike Hofer
Guest
Posts: n/a
 
      03-13-2007
On Mar 13, 8:47 am, ajf...@blueyonder.co.uk wrote:
> hi,
>
> I have an asp.net webform that contains some source like this
>
> <img src="..."><asp:hyperlink id=".." runat="server"...>
>
> with no whitespace between the tags. when the page is rendered, it
> comes out like this:
>
> <img src="..."> <asp:hyperlink id=".." runat="server"...>
>
> there are 2 tab characters between the end of the img tag and the
> hyperlink tag which cause a space to appear where I don't want it in
> the HTML.
>
> I have this exact sequence repeated in many places in the application
> (several times on the same page) and there are 2 that behave in this
> way, but I can't find any rhyme nor reason for it. there is no funny
> character in the source file.
>
> anyone else seen this problem? any ideas for a workaround?
>
> Andy


It's not ASP.NET 1.1 that's the culprit. It's your editor (likely
Visual Studio .NET 2002 or 2003). Both versions of Visual Studio are
notorious for mangling your HTML into what *they* want it to look
like, regardless of your best efforts to make it look the way *you*
want it.

It's a constant source of frustration.

In the end, however, unless the end-users are going to view the HTML,
or you're generating HTML to be parsed by a nitpicking parser that
can't handle the extraneous whitespace, the layout shouldn't matter.
It's an annoyance, and nothing more.

 
Reply With Quote
 
 
 
 
Mike Hofer
Guest
Posts: n/a
 
      03-13-2007
On Mar 13, 8:47 am, ajf...@blueyonder.co.uk wrote:
> hi,
>
> I have an asp.net webform that contains some source like this
>
> <img src="..."><asp:hyperlink id=".." runat="server"...>
>
> with no whitespace between the tags. when the page is rendered, it
> comes out like this:
>
> <img src="..."> <asp:hyperlink id=".." runat="server"...>
>
> there are 2 tab characters between the end of the img tag and the
> hyperlink tag which cause a space to appear where I don't want it in
> the HTML.
>
> I have this exact sequence repeated in many places in the application
> (several times on the same page) and there are 2 that behave in this
> way, but I can't find any rhyme nor reason for it. there is no funny
> character in the source file.
>
> anyone else seen this problem? any ideas for a workaround?
>
> Andy


Completely ignore my previous post. I totally misunderstood your post.
(Not enough coffee yet. It's not 6 PM yet.)

I *have* seen this issue before, and it's a bummer. I'm not sure what
I did to get around it. Have you tried cutting the page's HTML out and
pasting it into Notepad, then clearing the document, and repasting the
HTML?

There might be a control character embedded in the document that you
just can't see. (A smart tag or something stupid.)

 
Reply With Quote
 
ajfish@blueyonder.co.uk
Guest
Posts: n/a
 
      03-13-2007
ok, I have found a workaround

just above the offending tags I put this:

<span runat=server visible=false></span>

I've no idea how it works (and don't ask how much trial and error was
involved to discover it)


 
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
Re: Splitting text at whitespace but keeping the whitespace in thereturned list MRAB Python 3 01-26-2010 11:36 PM
Structure using whitespace vs logical whitespace cmdrrickhunter@yaho.com Python 10 12-16-2008 03:51 PM
spurious DMZ Barrett Bonden Cisco 1 02-01-2006 05:50 AM
Whitespace where I don't want whitespace! Oli Filth HTML 9 01-17-2005 08:47 PM
Spurious Access Mark St Laurent Cisco 6 10-01-2004 02:20 AM



Advertisments