Hi Brian,
I tested this on two machines and saw spaces before and after the
hyperlink. I used the code snippet which you posted.
1) version 1.1 of .NET on Win2003 server
2) version 1.0 sp2 of .NET on Win2000 professional
Can you retest on another machine?
Thank you, Mike
Microsoft, ASP.NET Support Professional
Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.
This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------[color=blue]
> From: "Brian W" <brianw@gold_death_2_spam_rush.com>
> References: <O1WnbVUqDHA.1488@TK2MSFTNGP12.phx.gbl>[/color]
<#ZY7z6UqDHA.2676@TK2MSFTNGP11.phx.gbl>
<e624qDVqDHA.2188@TK2MSFTNGP11.phx.gbl>
<uHb$wRVqDHA.1676@TK2MSFTNGP09.phx.gbl>
<e9OS0rVqDHA.2188@TK2MSFTNGP11.phx.gbl>
<O$rwANWqDHA.1928@TK2MSFTNGP12.phx.gbl>
<OGsVOWWqDHA.644@TK2MSFTNGP11.phx.gbl>
<y5N23pgqDHA.1992@cpmsftngxa06.phx.gbl>[color=blue]
> Subject: Re: Use of ASP.NET control does not preserve whitespace.
> Date: Thu, 13 Nov 2003 10:18:40 -0800
> Lines: 346
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> Message-ID: <OeniSKhqDHA.2692@TK2MSFTNGP09.phx.gbl>
> Newsgroups: microsoft.public.dotnet.framework.aspnet
> NNTP-Posting-Host: dsl-107.goldrush.com 206.171.170.107
> Path:[/color]
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
..phx.gbl!TK2MSFTNGP09.phx.gbl[color=blue]
> Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:190722
> X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>
> While I appreciate the time it took to respond to this thread you
> workarounds do not work (I have tried) as the problem is beyond the[/color]
editor.[color=blue]
>
> Please consider the following code , paying particular attention to the
> spaces:
>
> This text is before <asp:hyperlink id="hl1" runat="server"
> navivateurl="http://www.microsoft.com">link to microsoft</asp:hyperlink>
> This text is after
>
> When in HTML view, if I enter the code exactly as shown (as one single[/color]
line[color=blue]
> of code). Then I save (never switching to design mode) then compile and[/color]
run[color=blue]
> my code, the following is an example of the output of the page:
>
> This text is before link to microsoftThis text is after
>
> Notice the space is missing from between the words microsoft and This
>
> If there is any sort of whitespace after the hyperlink, space, newline,[/color]
tab,[color=blue]
> etc. the output should show a whitespace between these words, there is[/color]
not.[color=blue]
>
> This is, in all likelihood, a compiler issue. As I said in my original[/color]
post,[color=blue]
> if I replace the <asp:hyperlink> with an <a> tag the whitspace is[/color]
retained.[color=blue]
>
> True, there is a problem with the editor, I understand the complexity of
> fixing the formatting issue, however, IMO, giving a developer a way to
> switch off the formatting altogether would be a logical first step with,
> relatively, little effort. It certainly would be a step in the right
> direction. After all, this formatting issue affects EVERYONE who uses[/color]
VS.NET[color=blue]
> to edit ASP.NET pages.
>
>
> Regards
> Brian W
>
>
>
>
> ""Mike Moore [MSFT]"" <michmo@online.microsoft.com> wrote in message
> news:y5N23pgqDHA.1992@cpmsftngxa06.phx.gbl...[color=green]
> > Hi,
> >
> > This thread is discussing a bug in the Visual Studio .NET development
> > environment for ASP.NET. If you type directly into the HTML view of the
> > ASPX page, sometimes VS will reformat what you have typed.
> >
> > ---
> > First, I want to apologize for the inconvenience this bug has caused[/color][/color]
you.[color=blue][color=green]
> > We make the best products that we can. Being large & complex, it's hard[/color][/color]
to[color=blue][color=green]
> > make these products perfect in every way.
> >
> > There are two "partial" workarounds. These help, but do not fix the[/color]
> problem.[color=green]
> >
> > 1) Undo
> > Each time you return to HTML view, immediately run Undo. The formatting
> > changes mostly take place when you switch from design view to HTML view[/color]
> and[color=green]
> > these changes are mostly in a single undo entry. Calling undo then[/color]
> reverses[color=green]
> > many of the changes.
> >
> > 2) Save
> > Saving the ASPX page just prior to switching to design view reduces the
> > amount of reformatting the next time you switch back to HTML view.
> >
> > ---
> > Many people have asked why this bug has not been fixed.
> >
> > I found that the development team did seriously consider fixing this bug
> > for the 1.1 release. The first thought was to add an option to turn off[/color]
> the[color=green]
> > reformatting feature. Unfortunately, it turned out to be deeply[/color][/color]
integrated[color=blue][color=green]
> > in the code that makes the editor useful. So, it could not be turned[/color][/color]
off.[color=blue][color=green]
> > Nor could it easily be fixed. Any changes made to this area of the code
> > would definitely impact many aspects of the editor.
> >
> > If they could go back in time and rethink that decision, things might be
> > otherwise. However, at the time, the development team looked at all the
> > information they had available and decided that trying to fix this for[/color][/color]
the[color=blue][color=green]
> > 1.1 release would cause more harm than good.
> >
> > This continues to be considered an important item. So, I expect it will[/color][/color]
be[color=blue][color=green]
> > fixed, but I don't know when.
> >
> >
> > Thank you, Mike
> > Microsoft, ASP.NET Support Professional
> >
> > Microsoft highly recommends to all of our customers that they visit the
> >
http://www.microsoft.com/protect site and perform the three[/color]
> straightforward[color=green]
> > steps listed to improve your computer's security.
> >
> > This posting is provided "AS IS", with no warranties, and confers no[/color]
> rights.[color=green]
> >
> >
> > --------------------[color=darkred]
> > > From: "Brian W" <brianw@gold_death_2_spam_rush.com>
> > > References: <O1WnbVUqDHA.1488@TK2MSFTNGP12.phx.gbl>[/color]
> > <#ZY7z6UqDHA.2676@TK2MSFTNGP11.phx.gbl>
> > <e624qDVqDHA.2188@TK2MSFTNGP11.phx.gbl>
> > <uHb$wRVqDHA.1676@TK2MSFTNGP09.phx.gbl>
> > <e9OS0rVqDHA.2188@TK2MSFTNGP11.phx.gbl>
> > <O$rwANWqDHA.1928@TK2MSFTNGP12.phx.gbl>[color=darkred]
> > > Subject: Re: Use of ASP.NET control does not preserve whitespace.
> > > Date: Wed, 12 Nov 2003 13:40:10 -0800
> > > Lines: 198
> > > X-Priority: 3
> > > X-MSMail-Priority: Normal
> > > X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> > > Message-ID: <OGsVOWWqDHA.644@TK2MSFTNGP11.phx.gbl>
> > > Newsgroups: microsoft.public.dotnet.framework.aspnet
> > > NNTP-Posting-Host: dsl-107.goldrush.com 206.171.170.107
> > > Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
> > > Xref: cpmsftngxa06.phx.gbl[/color][/color]
> microsoft.public.dotnet.framework.aspnet:190501[color=green][color=darkred]
> > > X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> > >
> > > Yes, I too have since come to the same conclusion, with one addition.
> > >
> > > If, after the </asp:hyperlink> you place a space AND a carriage return[/color][/color]
> you[color=green][color=darkred]
> > > get the desired result.
> > >
> > > The problem here is that if you switch to design mode this formatting[/color][/color][/color]
is[color=blue][color=green][color=darkred]
> > > lost.
> > >
> > > What it all boils down to is this: The editor sucks! It is just plain
> > > unreasonable for an editor to format/change your code, whether you[/color][/color][/color]
what[color=blue]
> it[color=green][color=darkred]
> > > to, or not. It is also unreasonable that this formatting cannot be[/color]
> > switched[color=darkred]
> > > off!
> > >
> > > I have been through this code-formatting issue with someone with MS[/color]
> > before,[color=darkred]
> > > after they understood the problem they decided it wasn't important[/color][/color]
> enough[color=green]
> > to[color=darkred]
> > > fix!
> > >
> > >
> > > Regards
> > > Brian W
> > >
> > >
> > >
> > > "Cliff Harris" <hersh@myrealbox.com> wrote in message
> > > news:O$rwANWqDHA.1928@TK2MSFTNGP12.phx.gbl...
> > > > Yeah, I do understand that this is not a feasible option...
> > > > I do, however, think I know what's going on here...
> > > > I created a test page to try out some spacing issues and came up[/color][/color][/color]
with[color=blue][color=green]
> > the[color=darkred]
> > > > following:
> > > > 1. If you have a space before the control tag and after the control[/color][/color]
> tag,[color=green][color=darkred]
> > > it
> > > > only keep the one before
> > > > 2. If you only have a space after the control tag (ie[/color][/color][/color]
text<asp:textbox[color=blue][color=green][color=darkred]
> > > > ..>Hi</asp:textbox> AfterText), it keeps the space after.
> > > >
> > > > From this, here is my hypothesis:
> > > > I think that the IDE doesn't recognize that there is text between[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > > > opening and closing control tags. There for, as far as the IDE is
> > > > concerned, in your example, all you have in your html is
> > > > This is some text before And this is my text after the Hyperlink
> > > > (there are two spaces between "before" and "After")
> > > >
> > > > And since, if you have two spaces in a row in HTML, the second is[/color]
> > ignored,[color=darkred]
> > > > the IDE tries to be slick and remove one of them for you. I'm not[/color][/color]
> sure[color=green]
> > if[color=darkred]
> > > > this would count as a "bug"... but it is surely something that they[/color]
> > ought[color=darkred]
> > > to
> > > > work on...
> > > >
> > > > What do you think of the theory?
> > > >
> > > > -Cliff
> > > >
> > > > "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
> > > > news:e9OS0rVqDHA.2188@TK2MSFTNGP11.phx.gbl...
> > > > > Cliff,
> > > > >
> > > > > This situation is strange...
> > > > >
> > > > > If I go to HTML mode and enter the space in the control tag then[/color]
> > switch[color=darkred]
> > > to
> > > > > design mode the space dies not appear. However, when I switch back[/color][/color]
> to[color=green][color=darkred]
> > > HTML
> > > > > mode the space is retained.
> > > > >
> > > > > When compiled and run the tag shows the space.
> > > > >
> > > > > The problem with this approach is the style for hyperlinks (ie
> > > underline)
> > > > > applies to the space character as well.
> > > > >
> > > > >
> > > > > Regards
> > > > > Brian W
> > > > >
> > > > >
> > > > > "Cliff Harris" <hersh@myrealbox.com> wrote in message
> > > > > news:uHb$wRVqDHA.1676@TK2MSFTNGP09.phx.gbl...
> > > > > > That could be true...
> > > > > > I'm curious: If you place the space within the control tage,[/color][/color][/color]
will[color=blue][color=green]
> > it[color=darkred]
> > > be
> > > > > > removed?
> > > > > > Such as:
> > > > > > This is some text before <asp:hyperlink id="hl1" runat="server[/color][/color][/color]
"[color=blue][color=green][color=darkred]
> > > > > > navigateurl="http://www.microsoft.com">This is my link
> > > > </asp:hyperlink>And
> > > > > > this is my text after the Hyperlink
> > > > > >
> > > > > > I know this isn't necessarily a valid solution, but I'm curious[/color][/color][/color]
as[color=blue][color=green]
> > to[color=darkred]
> > > if
> > > > > the
> > > > > > space will be retained.
> > > > > >
> > > > > > -Cliff
> > > > > >
> > > > > > "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
> > > > > > news:e624qDVqDHA.2188@TK2MSFTNGP11.phx.gbl...
> > > > > > > Thanks for your comments, Cliff.
> > > > > > >
> > > > > > > No, I said "...not ALWAYS an expectable workaround"
> > > > > > >
> > > > > > > It has nothing to do with the number of keystrokes to type[/color]
> > " "[color=darkred]
> > > > The
> > > > > > > difference between having a non-breaking space and not having[/color][/color]
> one[color=green][color=darkred]
> > > > could
> > > > > in
> > > > > > > some cases make a difference between your layout looking good[/color][/color]
> and[color=green][color=darkred]
> > > > > looking
> > > > > > > like crap ;-)
> > > > > > >
> > > > > > > Regards
> > > > > > > Brian W
> > > > > > >
> > > > > > >
> > > > > > > "Cliff Harris" <hersh@myrealbox.com> wrote in message
> > > > > > > news:%23ZY7z6UqDHA.2676@TK2MSFTNGP11.phx.gbl...
> > > > > > > > I have noticed the same problem... it is, at times,[/color]
> > inconvenient.[color=darkred]
> > > > > > > > However, I do not understand why inserting an [/color][/color][/color]
character[color=blue][color=green][color=darkred]
> > > > > > > > isn't an acceptable workaround? Just a few more keystrokes[/color][/color][/color]
:)[color=blue][color=green][color=darkred]
> > > > > > > >
> > > > > > > >
> > > > > > > > "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in[/color][/color][/color]
message[color=blue][color=green][color=darkred]
> > > > > > > > news:O1WnbVUqDHA.1488@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > Yet another editor problem
> > > > > > > > >
> > > > > > > > > To reproduce do the following
> > > > > > > > >
> > > > > > > > > 1) Open a Webform and switch to HTML edit mode
> > > > > > > > >
> > > > > > > > > 2) Enter the Following (include spaces)
> > > > > > > > > This is some text before <asp:hyperlink id="hl1"
> > > > > runat="server
> > > > > > "
> > > > > > > > > navigateurl="http://www.microsoft.com">This is my
> > > > > link</asp:hyperlink>
> > > > > > > And
> > > > > > > > > this is my text after the Hyperlink
> > > > > > > > >
> > > > > > > > > 3) Switch back to design mode.
> > > > > > > > > Notice, the space has been remove between the[/color]
> > hyperlink[color=darkred]
> > > > and
> > > > > > the
> > > > > > > > word
> > > > > > > > > "And"
> > > > > > > > >
> > > > > > > > > 4) Now, in design mode type a space character between the
> > > > hyperlink
> > > > > > and
> > > > > > > > the
> > > > > > > > > word "And"
> > > > > > > > >
> > > > > > > > > 5) Switch back to HTML edit mode and notice the IDE[/color][/color][/color]
placed[color=blue]
> a[color=green][color=darkred]
> > > >
> > > > > > > where
> > > > > > > > > you typed the space character.
> > > > > > > > > This is not always an acceptable workaround.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > To prove this only happens with the ASP.NET control,[/color][/color][/color]
perform[color=blue][color=green]
> > the[color=darkred]
> > > > > > > following
> > > > > > > > > space
> > > > > > > > >
> > > > > > > > > 1) Open the Webform in HTML edit mode again
> > > > > > > > >
> > > > > > > > > 2) Enter the following (include spaces)
> > > > > > > > > This is some text before <a
> > > > > > href="http://www.microsoft.com">This
> > > > > > > > is
> > > > > > > > > my HTML hyperlink</a> And this text appears after the HTML
> > > > > hyperlink.
> > > > > > > > >
> > > > > > > > > 3) Switch to design mode
> > > > > > > > > Notice the space between the hyperlink and the[/color][/color][/color]
word[color=blue][color=green][color=darkred]
> > > "And"
> > > > is
> > > > > > > > > retained, and no characters are inserted.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Any recommendations?
> > > > > > > > >
> > > > > > > > > TIA
> > > > > > > > >
> > > > > > > > > Regards
> > > > > > > > > Brian W
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >[/color]
> >[/color]
>
>
>[/color]