55

I am introducing ASP.NET MVC to a new team and one of the questions that comes up often is "Is there a designer view"

Even if it's not for layout is there an IN visual studio design view for ASP.NET MVC3 using the razor view engine.

9
  • 3
    no, there is not. because there is no server controls like with web forms. everything is declarative, so what would you "drag and drop" ? Commented Dec 29, 2010 at 3:42
  • 33
    @Dan. Your bad crutch comment reminds me how in the olden days I was criticized for using debuggers for stepping through code in the days when debuggers were uncommon. I was told many times that it was a bad crutch. More recently, that Edit and Continue was a bad crutch, yet it was introduced into C#. Mark my words, a designer is coming. Commented Jun 2, 2012 at 5:43
  • 6
    @Dan Atkinson: Real men use Assembler, and bad web developers will be bad developers, designer or not. Commented Apr 18, 2013 at 18:09
  • 2
    Browsers are a crutch for bad developers. ;) Commented Feb 24, 2015 at 20:21
  • 3
    Browsers are a crutch for bad web users. I like to look at all my sites in pure structured text, the way god intended it... Commented Apr 2, 2015 at 17:53

7 Answers 7

55

No, there is no designer. It would likely be difficult for a designer to even know what is meant by Razor code in many cases.

It's really not so difficult to just use your web browser as a viewer. You can make changes to the HTML without having to recompile, just make the change, save, and refresh your browser.

EDIT (8/2/2013)

Since this answer was originally written, Microsoft has released Visual Studio 2012 which includes a feature called Page Inspector, which while not a true "designer" in the way that the question was written, it does give a much nicer semi-live preview mode. This has been improved in Visual Studio 2013 (which was RTM'd today, 10/17/13).

Sign up to request clarification or add additional context in comments.

2 Comments

Just to clarify a little bit, you can make changes to any view, partial view, or master page without having to recompile which includes any inline c# that you may have written, not just HTML. Only class files need recompiling.
The closest thing to a Designer in the way that the old Designers were sort of "meta" - they let you use Server Design Controls that would manipulate how the code itself worked, rather than being controls rendered by the code - is the Package-Manager console commands like Scaffold that generate things like Razor views for you. You could potentially use these commands or similar ones you write to help new developers get started with good outlines for their code.
10

I use a web browser window and set the url my localhost in place of the designer. view > "other windows" > "web browser". I then split the windows vertically or horizontaly.

1 Comment

This is very good except I sometimes get JavaScript error popup while doesn't happen when project strated in IE.
8

I was able to work using the following trick:

  1. change the razor file's extension to .html
  2. Open the document
  3. with the document open, change file extension back to .cshtml

Congratulations, you now have a designer's view of the razor file. If you need razor intellisense, close and re-open it.

1 Comment

Total hack, but I like it! I don't use it, but I like the trickery!
3

No, in general you should try and steer clear from visual designers. The combination of HTML/CSS/Javascript is something that just cannot be done well with visual designers and the short term pain of learning these manually will be well worth it. Once you know these well you will be coding in a cleaner and quicker way. I often use Expression Web to do initial layouts before copying it to Visual Studio.

1 Comment

Many exceptions including admin and internal tools that need supported and expanded by non-developers.10 years ago I would say the same. A designer that saves to its own format and emits HTML/CSS/Javascript would easily work fine. json schema forms is a good example.
2

I know I am late to the party, but..

You can trick the IDE as mentioned above, but if you are building applications in MVC, you should be comfortable in code view. It is more productive and most of the responsive design and css implementation can give you false results in design view. Designer is useful in WebForms. But with the Browser Link feature in Visual Studio 2013, there is no longer any reason to trick your IDE, you can have one-to-many browsers open and get live updates back and forth from browser to visual studio. Can't beat that! The browser is where it's at!

Browser Link!

Install the following and you will be golden!

Microsoft Visual Studio 2013 Update 3
Web Essentials (Dependent on VS Update 3)

Comments

2

I think they are working on that as a feature for Expression Blend 5 Developer Preview .

They clearly recognise the issue of designing JS in the designer so I suspect they realise the same applies to some designers working on MVC applications.

I was told by someone from Microsoft "I think in Blend for HTML, using interactive mode, you would probably be just fine with designing MVC or MVVM patterns"

Also check out Visual Studio Page Inspector it looks like it will do what is needed

In Visual Studio 2013 added browser link this allows two way communication between browser and Visual Studio. It means you can refresh browser when you change code and instantly see how it looks. Also you can change Css in the browser and have it saved in Visual Studio

Comments

-4

There is workaround it is mentioned here http://www.codeproject.com/KB/aspnet/EnablingDesignerSupport.aspx

3 Comments

I get "this article is still being written" and I cannot view it.
Im not going to downvote this because It's posted by the author, but Sumanta, you should hit the publish button on that article
I bumped you back up to zero, go fix the link!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.