Cообщество разработчиков на платформе Microsoft > Форумы > Visual C# IDE > Visual Studio 2008 - source view versus design view disparity
Задайте вопросЗадайте вопрос
 

ОтвеченоVisual Studio 2008 - source view versus design view disparity

  • 23 июля 2008 г. 17:01DD77 Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    Hi Guys

    I am working on C# web aspx pages.  If I edit a page in the design view (for example, text in an empty <td> tag pair, especially with carriage returns), very often the lead < of the next html tag is deleted, and the now incomplete tag is rendered to the design as text.  This has also removed large sections of the source on occasions, stretching 100s of characters into the document.  I have to be on my toes to save previous work regularly.

    Is anyone else experiencing this kind of behaviour?

    I am wondering if AVG version 8 is to blame, although it does not seem to affect any of the other editors I use daily.

    thanks

    DD.
    DD

Ответы

  • 28 июля 2008 г. 22:37DD77 Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     Отвечено
    I have just caught it red-handed.

    I had an HTML document loaded ( a longer one from Front Page Express, imported for editing up to aspx).

    The image in the top centre td element is an img tag, with a hard coded file reference.  I am looking at the visual designer, but the properties window is open.

    So I used the property window, I selected a correct relative path from the drop down.  Suddenly the whole page reformats.  It has eaten part of the td tag before the img itself, and replaced 

    <td width="150" bgcolor="#B77D7E">&nbsp;</td>

    with

    <td width="150" bgcolor="#B&nbsp;</td>

    I can get it to repeat this action by Ctrl-Z and then switching between views again.  It also ate the /td on one occasion in my testing, killing the table strcuture quite effectively.

    No master pages this time.

    DD.


    DD
    • Помечено в качестве ответаHanzheng Zou 30 июля 2008 г. 2:30
    •  
  • 29 июля 2008 г. 13:03TaylorMichaelLMVP, МодераторМедали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     Отвечено
    Great news!  Please post the sample project to the Connect site so an MS Support Engineer can reproduce the issue so it will be fixed.  Post the Connect link in this posting so it can be tracked by others.  Thanks for putting the effort in to trace this down.

    Michael Taylor - 7/29/08
    http://p3net.mvps.org
    • Помечено в качестве ответаHanzheng Zou 30 июля 2008 г. 2:30
    •  

Все ответы

  • 24 июля 2008 г. 16:45TaylorMichaelLMVP, МодераторМедали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    I see this all the time.  It is a bug in the designer but it can be hard to replicate.  I see it when I'm updating my website because I have DIVs embedded within P tags which are themselves nested in and around anchors.  The designer loses its mind and deletes text and moves things around.  It is a bug that hasn't been fixed as of VS2008 SP1 Beta.  I haven't submitted an issue on it at the Connect site yet because I haven't developed a reliable list of steps to follow to get it to blow up.  It definitely has something to do with nested tags in combination with making changes in the designer and then switching to the HTML view.  If MS had a way for me to debug this then I'd send them the log but as of yet I haven't pursued it.

    Michael Taylor - 7/24/08
    http://p3net.mvps.org
  • 24 июля 2008 г. 20:49DD77 Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     

    Hi Taylor

    I thought I was the only one in this universe with this problem!

    Right.  My use has also been what I would call traditional HTML tags - most especially large pages extending to 10,000 or so characters.  When it decides to chew or reformat it it does so in style with BIG sections going missing.

    A typical page would be structured...

    form
      div
        table
          tbody
            tr1
               td tdX td td - main tdX would have possibly 1,000 text characters in it, images, etc. 
            tr2
               td tdX td td - page 2 
            ..
            tr10

    I use a very simple piece of code in the Page_Load event to show or hide the rows, giving the illusion of multiple pages to the user on postback, using a command argument from a button on each page and a switch statement.

    For simple postcard business sites, this kind of long winded self-referencing page is about the quickest way I have found to work.

    My main problem is the tags get eaten when you edit visually and switch back.  This SERIOUSLY affects my workflow, and confidence in the editor.  In long pages, you don;t often notice until much later it has killed a <tr>..</tr> pair with all 1,000 characters gone...

    Maybe the length of page has something to do with it? 

    And you are right - I cannot define a set of steps to reproduce it easily.  Noticing it has happened can be a real challenge.

    DD.



    Note: I am using simple HTML tags mostly, not the ASP: equivalents.  My reason for this is another bug, where if you set properties to zero eg. margin:0px or padding:0px, these are often not rendered in the page, and so default to 1px in the browser.  This screws page layouts right up.  I haven't time to debug these things so we decided to use tags we could control more easily.  I think if you bother to set a property it should be rendered.  With C#'s nullable types, it should be easy enough to refactor the ASP: controls to spot when a value (even if zero) has been assigned...  But I digress.
         


    DD
  • 24 июля 2008 г. 20:55TaylorMichaelLMVP, МодераторМедали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    If we go on the assumption that we have the same problem then it would be unrelated to page size as my pages are relatively small, perhaps a 100 or so lines at most.  I'm under the theory that the designer loses track of the objects it is dealing with when it tries to sync up the visual and text views of the page.  It appears to me to be a problem when you have heavily nested tags.  In my case I always have the problem while inside a nesting of about 5 or 6 levels (if you include the master page).  It always mangles from the previous nesting level down.  What I haven't been able to deduce is if it is just losing its mind or if I'm doing something to trigger it.  In my experience it almost always happens when I take an existing P element with text in it and then convert it to a DIV tag.  Some time after that change I'll switch over to the visual designer to verify the layout and it mangles the text.

    Maybe someone from MS can confirm whether they are aware of this issue or not.

    Michael Taylor - 7/24/08
    http://p3net.mvps.org
  • 25 июля 2008 г. 0:34DD77 Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    Okay.

    Then I would add that very often my editing is simply the editing of the content inside a <td> pair, essentially the visible text and insertion/removal of carriage returns.  Very often, I need to reformat text post-first-draft, which will include adding or removing line breaks.  I have seen quite a bit of mangling having deleted carriage returns (<br />).

    I had not noticed the nesting relationship you observe, so I'll watch for that as we go on.

    I am not certain what triggers it. 

    Can you confirm if you are using any anti-phishing software in the background?  We have AVG 8 installed, and I have this piece part of it switched off.
     
    DD
  • 25 июля 2008 г. 19:28DD77 Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    And I would also add I am using Master pages with multiple content sections, so I don't have to keep publishing the same table structure to each page, and can concentrate on content.

    Do you think having a master page is the issue?

    DD
  • 28 июля 2008 г. 13:19TaylorMichaelLMVP, МодераторМедали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    Possibly.  I need to sit down and do some testing.  I'm hoping someone from MS will chime in and say it is a known issue.

    Michael Taylor - 7/28/08
    http://p3net.mvps.org
  • 28 июля 2008 г. 22:37DD77 Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     Отвечено
    I have just caught it red-handed.

    I had an HTML document loaded ( a longer one from Front Page Express, imported for editing up to aspx).

    The image in the top centre td element is an img tag, with a hard coded file reference.  I am looking at the visual designer, but the properties window is open.

    So I used the property window, I selected a correct relative path from the drop down.  Suddenly the whole page reformats.  It has eaten part of the td tag before the img itself, and replaced 

    <td width="150" bgcolor="#B77D7E">&nbsp;</td>

    with

    <td width="150" bgcolor="#B&nbsp;</td>

    I can get it to repeat this action by Ctrl-Z and then switching between views again.  It also ate the /td on one occasion in my testing, killing the table strcuture quite effectively.

    No master pages this time.

    DD.


    DD
    • Помечено в качестве ответаHanzheng Zou 30 июля 2008 г. 2:30
    •  
  • 29 июля 2008 г. 13:03TaylorMichaelLMVP, МодераторМедали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     Отвечено
    Great news!  Please post the sample project to the Connect site so an MS Support Engineer can reproduce the issue so it will be fixed.  Post the Connect link in this posting so it can be tracked by others.  Thanks for putting the effort in to trace this down.

    Michael Taylor - 7/29/08
    http://p3net.mvps.org
    • Помечено в качестве ответаHanzheng Zou 30 июля 2008 г. 2:30
    •  
  • 28 октября 2008 г. 19:35Digital Robot Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    My boss is experiencing this same problem.  Has anyone found a solution?