locked
Unable to work with display:none elements RRS feed

  • Question

  • User-228551200 posted

    I have some code that involves using some HTML elements that are initially set to "display:none".  When I view this in design mode in VS2010 they do not display.  When I try to enable them (view/visual aids) the VS2010 studio just crashes every time.

    I am now getting work done by setting them all to display:block (so I can see them while I'm working with them!), and when I deploy them, I have to go through the code (in source view) and manually turn them off.  Quite a PITA.  Does anyone have any idea why this feature will not work on my PC?

    Friday, February 8, 2013 9:34 AM

Answers

  • User-228551200 posted

    Breath2k thanks for the help, however if you read my question carefully, you'll see that I'm aware of this feature.  I'm asking why does my VS2010 crash when I try to enable it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 8, 2013 10:31 AM

All replies

  • User-58016157 posted

    Because they are set to display:none then obviously the design will not display it as it is representing the same effect as a user hitting the page.  If there are quite a few elements why don't you give them a class such as:

    .hideorshow { display:block; }

    Then you can just change this class to either display:block or display:none for development/deploy.

    Friday, February 8, 2013 10:06 AM
  • User-228551200 posted

    I'm not sure you understand the question I asked, but thanks for your help.  The idea of having an element you can see in design mode, but is invisible to the user at runtime (and possibly, ALWAYS invisible), is pretty commonplace.

    Having to modify code AFTER testing, but BEFORE deploying, is pretty bad programming practice, though if the program is trivial enough, you can hobble along that way too.

    Friday, February 8, 2013 10:21 AM
  • User-760709272 posted

    Could you explain why you need to use design mode and what you are doing in it?  In over 15 years I don't think I have once used design mode (the only times I use it is when I activate it by mistake and VisualStudio crashes).

    Friday, February 8, 2013 10:29 AM
  • User-58016157 posted

    VS 2008 + removed this feature from design mode by default however I believe I have found where to change it:

    On the Visual Studio menu go to View -> Visual Aids You should see CSS Display:none Elements and/or CSS Visibility:hidden Elements

    Friday, February 8, 2013 10:29 AM
  • User-228551200 posted

    Breath2k thanks for the help, however if you read my question carefully, you'll see that I'm aware of this feature.  I'm asking why does my VS2010 crash when I try to enable it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 8, 2013 10:31 AM
  • User-228551200 posted

    AidyF, I use design mode because it tends to be quicker than deploying it and checking what it looks like.  That's kind of the reason to use an IDE and not just a compiler w/batch files anyways...

    Friday, February 8, 2013 10:33 AM