Board index » Web Programming » hitting enter or shift+enter in asp.net designer messes up html code?

hitting enter or shift+enter in asp.net designer messes up html code?

Web Programming263
I was wondering if there was a way to hit enter to insert blank lines while

in the designer? I tried this but all it seems to want to do is insert code

that really shouldn't be there. For example, I had a heading 1 centered on a

page. Right under that I had some words in smaller print right under the

heading. When I hit enter after the heading 1, it automatically put the text

right below it in a <p></p>tag. I don't want this sort of stuff to happen

when I hit enter. The other problem I have is when I am creating a heading 1

later on the page and after hitting enter (shift enter) it stayed in the h1

tag and all text I typed was in a heading. Is there any way to stop that?


-
 

Re:hitting enter or shift+enter in asp.net designer messes up html code?

This really is the normal way the WYSIWYG editors behave. If you are in a

design and not code view, hitting enter will cerate a new paragraph as it is

designed to mimic a line break and carriage return. Shift+Enter is designed

to immitate a line break (<br />). This is pretty much how all html

designers (not just the MS ones) behave. Here's the problem, if you do

something in the designer, you are designing the page by creating HTML. If

you hit enter, what do you expect it to do? To move to the next line it has

to create HTML, there is no way around this because a simple line break in

the code is whitespace, which is ignored by the browser (as the HTML spec

says).



If you're within a tag such as a header, the designer wants to obey and

create the a simple line break within that tag. Again, this is exactly how

it should be and how other editors behave. Both these behaviors are

something you need to understand and become used to as it's simply how it is

supposed to work and how WYSIWYG editors do work.







--



Hope this helps,

Mark Fitzpatrick

Microsoft MVP - Expression





"Sunfire" <a_borka@sbcglobal.net>wrote in message

Quote
I was wondering if there was a way to hit enter to insert blank lines while

in the designer? I tried this but all it seems to want to do is insert code

that really shouldn't be there. For example, I had a heading 1 centered on

a page. Right under that I had some words in smaller print right under the

heading. When I hit enter after the heading 1, it automatically put the

text right below it in a <p></p>tag. I don't want this sort of stuff to

happen when I hit enter. The other problem I have is when I am creating a

heading 1 later on the page and after hitting enter (shift enter) it stayed

in the h1 tag and all text I typed was in a heading. Is there any way to

stop that?











-

Re:hitting enter or shift+enter in asp.net designer messes up html code?

I found that if you have details turned off in vs2005 designer, hitting

enter at the end of a line ignores the fact that you want to have the next

line in the same tag.

"Mark Fitzpatrick" <markfitz@fitzme.com>wrote in message

Quote
This really is the normal way the WYSIWYG editors behave. If you are in a

design and not code view, hitting enter will cerate a new paragraph as it

is designed to mimic a line break and carriage return. Shift+Enter is

designed to immitate a line break (<br />). This is pretty much how all

html designers (not just the MS ones) behave. Here's the problem, if you

do something in the designer, you are designing the page by creating HTML.

If you hit enter, what do you expect it to do? To move to the next line it

has to create HTML, there is no way around this because a simple line

break in the code is whitespace, which is ignored by the browser (as the

HTML spec says).



If you're within a tag such as a header, the designer wants to obey and

create the a simple line break within that tag. Again, this is exactly how

it should be and how other editors behave. Both these behaviors are

something you need to understand and become used to as it's simply how it

is supposed to work and how WYSIWYG editors do work.







--



Hope this helps,

Mark Fitzpatrick

Microsoft MVP - Expression





"Sunfire" <a_borka@sbcglobal.net>wrote in message

news:ud9jb7AIIHA.1184@TK2MSFTNGP04.phx.gbl...

>I was wondering if there was a way to hit enter to insert blank lines

>while in the designer? I tried this but all it seems to want to do is

>insert code that really shouldn't be there. For example, I had a heading 1

>centered on a page. Right under that I had some words in smaller print

>right under the heading. When I hit enter after the heading 1, it

>automatically put the text right below it in a <p></p>tag. I don't want

>this sort of stuff to happen when I hit enter. The other problem I have is

>when I am creating a heading 1 later on the page and after hitting enter

>(shift enter) it stayed in the h1 tag and all text I typed was in a

>heading. Is there any way to stop that?

>

>

>









-