Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use server-side Javascript to code views in Razor?

I've recently partnered up with a front-end developer with no C# experience, who is going to be coding the views for an ASP.NET MVC3 application I am building.

Since most web developers know Javascript, I thought it would be awesome to have him do the server-side code snips in Javascript rather than C# within Razor views. I know there isn't much code in views beyond outputting variables, etc., but there is some basic looping, etc.

I also really like the idea of having both client-side and server-side code in the views be the same language.

Is what I want to do possible? Is this a Node.js thing? (I haven't looked at that at all.)

like image 640
David Pfeffer Avatar asked Nov 04 '22 08:11

David Pfeffer


1 Answers

ASP.NET MVC requires you to use .NET 4.0. So you can use any CLS compliant language that compiles to MSIL to build the server side. As far as javascript is concerned, well, JScript.NET is now obsolete and currently I am not aware of an alternative.

As far as Razor is concerned, the only languages that the parser supports are C# and VB.NET. If you want to use some other language you will have to either build a parser for it or use an alternative view engine.

like image 67
Darin Dimitrov Avatar answered Nov 09 '22 04:11

Darin Dimitrov