473,396 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Use of ASP.NET control does not preserve whitespace.

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
11 3178
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: greenflame | last post by:
a = , ] b = , ] function addarr(A,B) { C = A; for (i=0;i<A.length;i++) { for (j=0;j<A.length;j++) {
0
by: serge | last post by:
I have an XML file with an XSD file. When i am reading the XML file and putting its content into a DataSet I notice that the field that has a single space character is being converted to a field...
6
by: Mark | last post by:
In a specification I'm designing, I'd like to specify that the order of Names (IDs) in an attribute value of datatype IDREFS is significant. My question is if most real-world XML parsers...
2
by: jesl | last post by:
Group, I have created a User Control with the property "Html" of type string. If I declare this control on an ASPX page with the value "<b>This is an entity: &lt;</b>" for the property "Html", the...
44
by: rhythmace | last post by:
W3C HTML validator passes this: .... <script type="text/javascript" src="foo.js"> <script type="text/javascript"> ....script in here... </script> ....
1
by: soup_or_power | last post by:
I am unable to preserve white space. Here is my code: public class xml { public static void main(String args) { try{ String jaxpPropertyName = "javax.xml.parsers.SAXParserFactory"; if...
2
by: daftspaniel | last post by:
Hi Folks, I am trying to scan the lines in the string text: lines = text.split('\n') seemed to do the job but has the side effect of stripping the whitespace. As I am reading Python source in...
11
by: Webbert | last post by:
I am trying to display XML in a WebBrowser Control. I receive a data feed of XML and am trying to inject it into the control. I have not been successful in doing so. The only solution I have...
1
by: www.douglassdavis.com | last post by:
it seems every time i pass some text through an applet parameter, say: .... <PARAM name="mytext" value=' This is a test '> ....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.