By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,301 Members | 1,752 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,301 IT Pros & Developers. It's quick & easy.

Use of ASP.NET control does not preserve whitespace.

P: n/a
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 hyperlink 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 placed a &nbsp; where
you typed the space character.
This is not always an acceptable workaround.
To prove this only happens with the ASP.NET control, perform the 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 word "And" is
retained, and no &nbsp; characters are inserted.
Any recommendations?

TIA

Regards
Brian W

Nov 17 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
I have noticed the same problem... it is, at times, inconvenient.
However, I do not understand why inserting an &nbsp; character
isn't an acceptable workaround? Just a few more keystrokes :)
"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:O1**************@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 hyperlink 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 placed a &nbsp; where
you typed the space character.
This is not always an acceptable workaround.
To prove this only happens with the ASP.NET control, perform the 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 word "And" is
retained, and no &nbsp; characters are inserted.
Any recommendations?

TIA

Regards
Brian W

Nov 17 '05 #2

P: n/a
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 "&nbsp;" The
difference between having a non-breaking space and not having one could in
some cases make a difference between your layout looking good and looking
like crap ;-)

Regards
Brian W
"Cliff Harris" <he***@myrealbox.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have noticed the same problem... it is, at times, inconvenient.
However, I do not understand why inserting an &nbsp; character
isn't an acceptable workaround? Just a few more keystrokes :)
"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:O1**************@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 hyperlink 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 placed a &nbsp; where you typed the space character.
This is not always an acceptable workaround.
To prove this only happens with the ASP.NET control, perform the 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 word "And" is
retained, and no &nbsp; characters are inserted.
Any recommendations?

TIA

Regards
Brian W


Nov 17 '05 #3

P: n/a
While I'm on the editor subject...

Why does the editor change &copy; to © ?

I know they mean the same thing, but would the actual © character be
recognized accross browsers?

Regards
Brian W

"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:O1**************@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 hyperlink 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 placed a &nbsp; where
you typed the space character.
This is not always an acceptable workaround.
To prove this only happens with the ASP.NET control, perform the 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 word "And" is
retained, and no &nbsp; characters are inserted.
Any recommendations?

TIA

Regards
Brian W

Nov 17 '05 #4

P: n/a
That could be true...
I'm curious: If you place the space within the control tage, will it be
removed?
Such as:
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

I know this isn't necessarily a valid solution, but I'm curious as to if the
space will be retained.

-Cliff

"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:e6**************@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 "&nbsp;" The
difference between having a non-breaking space and not having one could in
some cases make a difference between your layout looking good and looking
like crap ;-)

Regards
Brian W
"Cliff Harris" <he***@myrealbox.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have noticed the same problem... it is, at times, inconvenient.
However, I do not understand why inserting an &nbsp; character
isn't an acceptable workaround? Just a few more keystrokes :)
"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:O1**************@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 hyperlink 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 placed a &nbsp; where you typed the space character.
This is not always an acceptable workaround.
To prove this only happens with the ASP.NET control, perform the 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 word "And" is
retained, and no &nbsp; characters are inserted.
Any recommendations?

TIA

Regards
Brian W



Nov 17 '05 #5

P: n/a
Cliff,

This situation is strange...

If I go to HTML mode and enter the space in the control tag then switch to
design mode the space dies not appear. However, when I switch back to 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" <he***@myrealbox.com> wrote in message
news:uH**************@TK2MSFTNGP09.phx.gbl...
That could be true...
I'm curious: If you place the space within the control tage, will it be
removed?
Such as:
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

I know this isn't necessarily a valid solution, but I'm curious as to if the space will be retained.

-Cliff

"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:e6**************@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 "&nbsp;" The
difference between having a non-breaking space and not having one could in
some cases make a difference between your layout looking good and looking like crap ;-)

Regards
Brian W
"Cliff Harris" <he***@myrealbox.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have noticed the same problem... it is, at times, inconvenient.
However, I do not understand why inserting an &nbsp; character
isn't an acceptable workaround? Just a few more keystrokes :)
"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:O1**************@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 hyperlink 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 placed a &nbsp;

where
> you typed the space character.
> This is not always an acceptable workaround.
>
>
> To prove this only happens with the ASP.NET control, perform the

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 word "And" is
> retained, and no &nbsp; characters are inserted.
>
>
> Any recommendations?
>
> TIA
>
> Regards
> Brian W
>
>
>



Nov 17 '05 #6

P: n/a
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 with the
following:
1. If you have a space before the control tag and after the control tag, it
only keep the one before
2. If you only have a space after the control tag (ie text<asp:textbox
...>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 the
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 ignored,
the IDE tries to be slick and remove one of them for you. I'm not sure if
this would count as a "bug"... but it is surely something that they ought to
work on...

What do you think of the theory?

-Cliff

"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl...
Cliff,

This situation is strange...

If I go to HTML mode and enter the space in the control tag then switch to
design mode the space dies not appear. However, when I switch back to 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" <he***@myrealbox.com> wrote in message
news:uH**************@TK2MSFTNGP09.phx.gbl...
That could be true...
I'm curious: If you place the space within the control tage, will it be
removed?
Such as:
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

I know this isn't necessarily a valid solution, but I'm curious as to if the
space will be retained.

-Cliff

"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:e6**************@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 "&nbsp;" The difference between having a non-breaking space and not having one could in some cases make a difference between your layout looking good and looking like crap ;-)

Regards
Brian W
"Cliff Harris" <he***@myrealbox.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> I have noticed the same problem... it is, at times, inconvenient.
> However, I do not understand why inserting an &nbsp; character
> isn't an acceptable workaround? Just a few more keystrokes :)
>
>
> "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
> news:O1**************@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 hyperlink
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 placed a

&nbsp; where
> > you typed the space character.
> > This is not always an acceptable workaround.
> >
> >
> > To prove this only happens with the ASP.NET control, perform the
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 word "And" is > > retained, and no &nbsp; characters are inserted.
> >
> >
> > Any recommendations?
> >
> > TIA
> >
> > Regards
> > Brian W
> >
> >
> >
>
>



Nov 17 '05 #7

P: n/a
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 you
get the desired result.

The problem here is that if you switch to design mode this formatting is
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 what it
to, or not. It is also unreasonable that this formatting cannot be switched
off!

I have been through this code-formatting issue with someone with MS before,
after they understood the problem they decided it wasn't important enough to
fix!
Regards
Brian W

"Cliff Harris" <he***@myrealbox.com> wrote in message
news:O$**************@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 with the
following:
1. If you have a space before the control tag and after the control tag, it only keep the one before
2. If you only have a space after the control tag (ie text<asp:textbox
..>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 the
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 ignored,
the IDE tries to be slick and remove one of them for you. I'm not sure if
this would count as a "bug"... but it is surely something that they ought to work on...

What do you think of the theory?

-Cliff

"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl...
Cliff,

This situation is strange...

If I go to HTML mode and enter the space in the control tag then switch to
design mode the space dies not appear. However, when I switch back to 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" <he***@myrealbox.com> wrote in message
news:uH**************@TK2MSFTNGP09.phx.gbl...
That could be true...
I'm curious: If you place the space within the control tage, will it be removed?
Such as:
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

I know this isn't necessarily a valid solution, but I'm curious as to
if the
space will be retained.

-Cliff

"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:e6**************@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 "&nbsp;"
The > difference between having a non-breaking space and not having one could
in
> some cases make a difference between your layout looking good and

looking
> like crap ;-)
>
> Regards
> Brian W
>
>
> "Cliff Harris" <he***@myrealbox.com> wrote in message
> news:%2****************@TK2MSFTNGP11.phx.gbl...
> > I have noticed the same problem... it is, at times, inconvenient.
> > However, I do not understand why inserting an &nbsp; character
> > isn't an acceptable workaround? Just a few more keystrokes :)
> >
> >
> > "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
> > news:O1**************@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 hyperlink

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 placed a &nbsp; > where
> > > you typed the space character.
> > > This is not always an acceptable workaround.
> > >
> > >
> > > To prove this only happens with the ASP.NET control, perform the
> 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 word
"And" is > > > retained, and no &nbsp; characters are inserted.
> > >
> > >
> > > Any recommendations?
> > >
> > > TIA
> > >
> > > Regards
> > > Brian W
> > >
> > >
> > >
> >
> >
>
>



Nov 17 '05 #8

P: n/a
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 you.
We make the best products that we can. Being large & complex, it's hard to
make these products perfect in every way.

There are two "partial" workarounds. These help, but do not fix the problem.

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 and
these changes are mostly in a single undo entry. Calling undo then reverses
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 the
reformatting feature. Unfortunately, it turned out to be deeply integrated
in the code that makes the editor useful. So, it could not be turned off.
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 the
1.1 release would cause more harm than good.

This continues to be considered an important item. So, I expect it will be
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 straightforward
steps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "Brian W" <brianw@gold_death_2_spam_rush.com>
References: <O1**************@TK2MSFTNGP12.phx.gbl> <#Z**************@TK2MSFTNGP11.phx.gbl>
<e6**************@TK2MSFTNGP11.phx.gbl>
<uH**************@TK2MSFTNGP09.phx.gbl>
<e9**************@TK2MSFTNGP11.phx.gbl>
<O$**************@TK2MSFTNGP12.phx.gbl> 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: <OG*************@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 microsoft.public.dotnet.framework.aspnet:190501
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 you
get the desired result.

The problem here is that if you switch to design mode this formatting is
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 what it
to, or not. It is also unreasonable that this formatting cannot be switched off!

I have been through this code-formatting issue with someone with MS before, after they understood the problem they decided it wasn't important enough to fix!
Regards
Brian W

"Cliff Harris" <he***@myrealbox.com> wrote in message
news:O$**************@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 with the
following:
1. If you have a space before the control tag and after the control tag, it
only keep the one before
2. If you only have a space after the control tag (ie text<asp:textbox
..>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 the
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 ignored, the IDE tries to be slick and remove one of them for you. I'm not sure if this would count as a "bug"... but it is surely something that they ought to
work on...

What do you think of the theory?

-Cliff

"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl...
Cliff,

This situation is strange...

If I go to HTML mode and enter the space in the control tag then switch
to design mode the space dies not appear. However, when I switch back to 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" <he***@myrealbox.com> wrote in message
news:uH**************@TK2MSFTNGP09.phx.gbl...
> That could be true...
> I'm curious: If you place the space within the control tage, will
it
be > removed?
> Such as:
> 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
>
> I know this isn't necessarily a valid solution, but I'm curious as
to if the
> space will be retained.
>
> -Cliff
>
> "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
> news:e6**************@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

"&nbsp;" The
> > difference between having a non-breaking space and not having one

could
in
> > some cases make a difference between your layout looking good and
looking
> > like crap ;-)
> >
> > Regards
> > Brian W
> >
> >
> > "Cliff Harris" <he***@myrealbox.com> wrote in message
> > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > > I have noticed the same problem... it is, at times,
inconvenient. > > > However, I do not understand why inserting an &nbsp; character
> > > isn't an acceptable workaround? Just a few more keystrokes :)
> > >
> > >
> > > "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
> > > news:O1**************@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 hyperlink 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 placed a

&nbsp;
> > where
> > > > you typed the space character.
> > > > This is not always an acceptable workaround.
> > > >
> > > >
> > > > To prove this only happens with the ASP.NET control, perform

the > > 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 word

"And"
is
> > > > retained, and no &nbsp; characters are inserted.
> > > >
> > > >
> > > > Any recommendations?
> > > >
> > > > TIA
> > > >
> > > > Regards
> > > > Brian W
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>




Nov 17 '05 #9

P: n/a
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 editor.

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 line
of code). Then I save (never switching to design mode) then compile and run
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, tab,
etc. the output should show a whitespace between these words, there is not.

This is, in all likelihood, a compiler issue. As I said in my original post,
if I replace the <asp:hyperlink> with an <a> tag the whitspace is retained.

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 VS.NET
to edit ASP.NET pages.
Regards
Brian W


""Mike Moore [MSFT]"" <mi****@online.microsoft.com> wrote in message
news:y5**************@cpmsftngxa06.phx.gbl...
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 you.
We make the best products that we can. Being large & complex, it's hard to
make these products perfect in every way.

There are two "partial" workarounds. These help, but do not fix the problem.
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 and these changes are mostly in a single undo entry. Calling undo then reverses 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 the reformatting feature. Unfortunately, it turned out to be deeply integrated
in the code that makes the editor useful. So, it could not be turned off.
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 the
1.1 release would cause more harm than good.

This continues to be considered an important item. So, I expect it will be
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 straightforward steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
From: "Brian W" <brianw@gold_death_2_spam_rush.com>
References: <O1**************@TK2MSFTNGP12.phx.gbl> <#Z**************@TK2MSFTNGP11.phx.gbl>
<e6**************@TK2MSFTNGP11.phx.gbl>
<uH**************@TK2MSFTNGP09.phx.gbl>
<e9**************@TK2MSFTNGP11.phx.gbl>
<O$**************@TK2MSFTNGP12.phx.gbl>
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: <OG*************@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 microsoft.public.dotnet.framework.aspnet:190501
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 you get the desired result.

The problem here is that if you switch to design mode this formatting is
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 what it to, or not. It is also unreasonable that this formatting cannot be

switched
off!

I have been through this code-formatting issue with someone with MS

before,
after they understood the problem they decided it wasn't important enough to
fix!
Regards
Brian W

"Cliff Harris" <he***@myrealbox.com> wrote in message
news:O$**************@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 with
the following:
1. If you have a space before the control tag and after the control tag, it
only keep the one before
2. If you only have a space after the control tag (ie text<asp:textbox
..>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 the
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 ignored, the IDE tries to be slick and remove one of them for you. I'm not
sure if this would count as a "bug"... but it is surely something that they ought
to
work on...

What do you think of the theory?

-Cliff

"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl...
> Cliff,
>
> This situation is strange...
>
> If I go to HTML mode and enter the space in the control tag then switch
to
> design mode the space dies not appear. However, when I switch back

to 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" <he***@myrealbox.com> wrote in message
> news:uH**************@TK2MSFTNGP09.phx.gbl...
> > That could be true...
> > I'm curious: If you place the space within the control tage, will

it
be
> > removed?
> > Such as:
> > 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
> >
> > I know this isn't necessarily a valid solution, but I'm curious as

to
if
> the
> > space will be retained.
> >
> > -Cliff
> >
> > "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
> > news:e6**************@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

"&nbsp;" The
> > > difference between having a non-breaking space and not having
one could
> in
> > > some cases make a difference between your layout looking good and > looking
> > > like crap ;-)
> > >
> > > Regards
> > > Brian W
> > >
> > >
> > > "Cliff Harris" <he***@myrealbox.com> wrote in message
> > > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > > > I have noticed the same problem... it is, at times,

inconvenient. > > > > However, I do not understand why inserting an &nbsp; character
> > > > isn't an acceptable workaround? Just a few more keystrokes :)
> > > >
> > > >
> > > > "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
> > > > news:O1**************@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 hyperlink 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 placed a &nbsp;
> > > where
> > > > > you typed the space character.
> > > > > This is not always an acceptable workaround.
> > > > >
> > > > >
> > > > > To prove this only happens with the ASP.NET control, perform the > > > 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 word

"And"
is
> > > > > retained, and no &nbsp; characters are inserted.
> > > > >
> > > > >
> > > > > Any recommendations?
> > > > >
> > > > > TIA
> > > > >
> > > > > Regards
> > > > > Brian W
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Nov 17 '05 #10

P: n/a
Hi Brian,

I just tested your code snippet on my machine and I saw the space both
before and after the hyperlink in the browser. I'm running .NET 1.1 on
Win2003 server.

I will setup win2000 with .NET 1.0 and 1.1 to see if the problem occurs for
me on either of them. I'll let you know the results.

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.
--------------------
From: "Brian W" <brianw@gold_death_2_spam_rush.com>
References: <O1**************@TK2MSFTNGP12.phx.gbl> <#Z**************@TK2MSFTNGP11.phx.gbl>
<e6**************@TK2MSFTNGP11.phx.gbl>
<uH**************@TK2MSFTNGP09.phx.gbl>
<e9**************@TK2MSFTNGP11.phx.gbl>
<O$**************@TK2MSFTNGP12.phx.gbl>
<OG*************@TK2MSFTNGP11.phx.gbl>
<y5**************@cpmsftngxa06.phx.gbl> 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: <Oe**************@TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: dsl-107.goldrush.com 206.171.170.107
Path: cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
phx.gbl!TK2MSFTNGP09.phx.gbl 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 editor.
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 line of code). Then I save (never switching to design mode) then compile and run 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, tab, etc. the output should show a whitespace between these words, there is not.
This is, in all likelihood, a compiler issue. As I said in my original post, if I replace the <asp:hyperlink> with an <a> tag the whitspace is retained.
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 VS.NET to edit ASP.NET pages.
Regards
Brian W


""Mike Moore [MSFT]"" <mi****@online.microsoft.com> wrote in message
news:y5**************@cpmsftngxa06.phx.gbl...
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 you.
We make the best products that we can. Being large & complex, it's hard to make these products perfect in every way.

There are two "partial" workarounds. These help, but do not fix the problem.

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

and
these changes are mostly in a single undo entry. Calling undo then

reverses
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

the
reformatting feature. Unfortunately, it turned out to be deeply integrated in the code that makes the editor useful. So, it could not be turned off. 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 the 1.1 release would cause more harm than good.

This continues to be considered an important item. So, I expect it will be 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

straightforward
steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no

rights.


--------------------
From: "Brian W" <brianw@gold_death_2_spam_rush.com>
References: <O1**************@TK2MSFTNGP12.phx.gbl>

<#Z**************@TK2MSFTNGP11.phx.gbl>
<e6**************@TK2MSFTNGP11.phx.gbl>
<uH**************@TK2MSFTNGP09.phx.gbl>
<e9**************@TK2MSFTNGP11.phx.gbl>
<O$**************@TK2MSFTNGP12.phx.gbl>
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: <OG*************@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 microsoft.public.dotnet.framework.aspnet:190501 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 you get the desired result.

The problem here is that if you switch to design mode this formatting is 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 what it
to, or not. It is also unreasonable that this formatting cannot be switched
off!

I have been through this code-formatting issue with someone with MS

before,
after they understood the problem they decided it wasn't important enough
to
fix!
Regards
Brian W

"Cliff Harris" <he***@myrealbox.com> wrote in message
news:O$**************@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

with the
> following:
> 1. If you have a space before the control tag and after the control tag, it
> only keep the one before
> 2. If you only have a space after the control tag (ie
text<asp:textbox > ..>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 the > 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

ignored,
> the IDE tries to be slick and remove one of them for you. I'm not

sure
if
> this would count as a "bug"... but it is surely something that they

ought
to
> work on...
>
> What do you think of the theory?
>
> -Cliff
>
> "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
> news:e9**************@TK2MSFTNGP11.phx.gbl...
> > Cliff,
> >
> > This situation is strange...
> >
> > If I go to HTML mode and enter the space in the control tag then

switch
to
> > design mode the space dies not appear. However, when I switch back

to 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" <he***@myrealbox.com> wrote in message
> > news:uH**************@TK2MSFTNGP09.phx.gbl...
> > > That could be true...
> > > I'm curious: If you place the space within the control tage, will it
be
> > > removed?
> > > Such as:
> > > 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
> > >
> > > I know this isn't necessarily a valid solution, but I'm curious as
to
if
> > the
> > > space will be retained.
> > >
> > > -Cliff
> > >
> > > "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
> > > news:e6**************@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

"&nbsp;"
> The
> > > > difference between having a non-breaking space and not having one > could
> > in
> > > > some cases make a difference between your layout looking good and > > looking
> > > > like crap ;-)
> > > >
> > > > Regards
> > > > Brian W
> > > >
> > > >
> > > > "Cliff Harris" <he***@myrealbox.com> wrote in message
> > > > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > > > > I have noticed the same problem... it is, at times,

inconvenient.
> > > > > However, I do not understand why inserting an &nbsp;
character > > > > > isn't an acceptable workaround? Just a few more keystrokes :) > > > > >
> > > > >
> > > > > "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message > > > > > news:O1**************@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

hyperlink
> 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 placed a > &nbsp;
> > > > where
> > > > > > you typed the space character.
> > > > > > This is not always an acceptable workaround.
> > > > > >
> > > > > >
> > > > > > To prove this only happens with the ASP.NET control,

perform the
> > > > 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

word "And"
> is
> > > > > > retained, and no &nbsp; characters are inserted.
> > > > > >
> > > > > >
> > > > > > Any recommendations?
> > > > > >
> > > > > > TIA
> > > > > >
> > > > > > Regards
> > > > > > Brian W
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 17 '05 #11

P: n/a
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.
--------------------
From: "Brian W" <brianw@gold_death_2_spam_rush.com>
References: <O1**************@TK2MSFTNGP12.phx.gbl> <#Z**************@TK2MSFTNGP11.phx.gbl>
<e6**************@TK2MSFTNGP11.phx.gbl>
<uH**************@TK2MSFTNGP09.phx.gbl>
<e9**************@TK2MSFTNGP11.phx.gbl>
<O$**************@TK2MSFTNGP12.phx.gbl>
<OG*************@TK2MSFTNGP11.phx.gbl>
<y5**************@cpmsftngxa06.phx.gbl> 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: <Oe**************@TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: dsl-107.goldrush.com 206.171.170.107
Path: cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
..phx.gbl!TK2MSFTNGP09.phx.gbl 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 editor.
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 line of code). Then I save (never switching to design mode) then compile and run 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, tab, etc. the output should show a whitespace between these words, there is not.
This is, in all likelihood, a compiler issue. As I said in my original post, if I replace the <asp:hyperlink> with an <a> tag the whitspace is retained.
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 VS.NET to edit ASP.NET pages.
Regards
Brian W


""Mike Moore [MSFT]"" <mi****@online.microsoft.com> wrote in message
news:y5**************@cpmsftngxa06.phx.gbl...
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 you.
We make the best products that we can. Being large & complex, it's hard to make these products perfect in every way.

There are two "partial" workarounds. These help, but do not fix the problem.

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

and
these changes are mostly in a single undo entry. Calling undo then

reverses
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

the
reformatting feature. Unfortunately, it turned out to be deeply integrated in the code that makes the editor useful. So, it could not be turned off. 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 the 1.1 release would cause more harm than good.

This continues to be considered an important item. So, I expect it will be 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

straightforward
steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no

rights.


--------------------
From: "Brian W" <brianw@gold_death_2_spam_rush.com>
References: <O1**************@TK2MSFTNGP12.phx.gbl>

<#Z**************@TK2MSFTNGP11.phx.gbl>
<e6**************@TK2MSFTNGP11.phx.gbl>
<uH**************@TK2MSFTNGP09.phx.gbl>
<e9**************@TK2MSFTNGP11.phx.gbl>
<O$**************@TK2MSFTNGP12.phx.gbl>
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: <OG*************@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 microsoft.public.dotnet.framework.aspnet:190501 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 you get the desired result.

The problem here is that if you switch to design mode this formatting is 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 what it
to, or not. It is also unreasonable that this formatting cannot be switched
off!

I have been through this code-formatting issue with someone with MS

before,
after they understood the problem they decided it wasn't important enough
to
fix!
Regards
Brian W

"Cliff Harris" <he***@myrealbox.com> wrote in message
news:O$**************@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

with the
> following:
> 1. If you have a space before the control tag and after the control tag, it
> only keep the one before
> 2. If you only have a space after the control tag (ie
text<asp:textbox > ..>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 the > 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

ignored,
> the IDE tries to be slick and remove one of them for you. I'm not

sure
if
> this would count as a "bug"... but it is surely something that they

ought
to
> work on...
>
> What do you think of the theory?
>
> -Cliff
>
> "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
> news:e9**************@TK2MSFTNGP11.phx.gbl...
> > Cliff,
> >
> > This situation is strange...
> >
> > If I go to HTML mode and enter the space in the control tag then

switch
to
> > design mode the space dies not appear. However, when I switch back

to 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" <he***@myrealbox.com> wrote in message
> > news:uH**************@TK2MSFTNGP09.phx.gbl...
> > > That could be true...
> > > I'm curious: If you place the space within the control tage, will it
be
> > > removed?
> > > Such as:
> > > 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
> > >
> > > I know this isn't necessarily a valid solution, but I'm curious as
to
if
> > the
> > > space will be retained.
> > >
> > > -Cliff
> > >
> > > "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
> > > news:e6**************@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

"&nbsp;"
> The
> > > > difference between having a non-breaking space and not having one > could
> > in
> > > > some cases make a difference between your layout looking good and > > looking
> > > > like crap ;-)
> > > >
> > > > Regards
> > > > Brian W
> > > >
> > > >
> > > > "Cliff Harris" <he***@myrealbox.com> wrote in message
> > > > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > > > > I have noticed the same problem... it is, at times,

inconvenient.
> > > > > However, I do not understand why inserting an &nbsp;
character > > > > > isn't an acceptable workaround? Just a few more keystrokes :) > > > > >
> > > > >
> > > > > "Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message > > > > > news:O1**************@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

hyperlink
> 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 placed a > &nbsp;
> > > > where
> > > > > > you typed the space character.
> > > > > > This is not always an acceptable workaround.
> > > > > >
> > > > > >
> > > > > > To prove this only happens with the ASP.NET control,

perform the
> > > > 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

word "And"
> is
> > > > > > retained, and no &nbsp; characters are inserted.
> > > > > >
> > > > > >
> > > > > > Any recommendations?
> > > > > >
> > > > > > TIA
> > > > > >
> > > > > > Regards
> > > > > > Brian W
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.