user191152
user191152

Reputation:

ASP.NET MVC "View" coding

I'm extremely annoyed with the way Visual Studio works when I write inline C#/MVC in the View. I think the source is horrendous to look at, and I wonder if there aren't some alternatives available, to make the View-code look prettier.

Perhaps some kind of extension-language or pre-processing formatting...

** EDIT **

Found:

any other suggestions ?

Upvotes: 1

Views: 228

Answers (3)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

In general you need to avoid writing too much C# in your Views. They should contain primary HTML which should be readable. Also there are some alternative view engines to the default WebForms.

Upvotes: 0

Marc Gravell
Marc Gravell

Reputation: 1062510

If you just want the existing engine to be prettier.... well, tough - it is what it is. You can try to take care when laying it out, and move common code into methods (perhaps extension methods on HtmlHelper for common code) to reduce the noise, but that's about it.

However, you are not limited this this engine - you can use any suitable template engine (or write your own).

Upvotes: 0

Miyagi Coder
Miyagi Coder

Reputation: 5532

I found the Spark view engine cleans thing up.

http://sparkviewengine.com/

Upvotes: 1

Related Questions