views:

666

answers:

3

Hi there,

Anyone had a chance to use the javascript MVC framework with ASP.NET MVC?

Basically i looking for advise on a way of using them together if possible, my asp.net MVC app i can't get rid of but i would love to use some sort of separation of concern for the javascript / Jquery...

Anybody used something like this? I am trying to picture the 2 together, because asp.net mvc provides VIEWS maybe the 2 would be incompatible....??

Or would it be better to use just a OOP extension framework for javascript and if so ... anybody know a good one that would work side by side with asp.net mvc?

Thanks in advance

A: 

it is the JavascriptMVC framework i am talking about http://www.javascriptmvc.com/

+3  A: 

Hi Mark,

I'm one of the JMVC guys. Yes you can use those two together. We advice using REST services to separate your client/server layers, as it provides the cleanest separation for your data. With REST you'd consume data with your client by making requests for all todos, which would come back as JSON. JavaScriptMVC would then call a callback to your controller, and you'd use a client side template (view) to render the data.

The two are definitely compatible, but it depends on where you want your logic to exist. A thick client has many advantages, including scalability and maintainability.

moschel
Thanks for the info, i am little confused how the Views (asp.net mvc html templates) and views from jmvc can co-exist... I need the asp.net mvc views and these filled by my asp.net mvc controller ... server side... My idea was to have good separation of concerns for javascript but staying compat with asp.net mvc views ...
mark smith
I have just been taking a look at the jmvc 2.0 - it looks really cool, i would be nice if you could confirm here or blog or put something in jmvc 2.0 docs with regards to working with server side stuff and the ability to work nicely with asp.net mvc templates (views) ..... I am very excited about the featues jmvc offers and now with 2.0 even more soo.... If i can find some kind of confirmation with regards to the above then i will download it and start a sample app.
mark smith
+3  A: 

Mark, I'm another contributor to JMVC. JMVC is designed to work from raw data services, but it can wear many hats.

It's based on thin server architecture. For example, instead of splitting creating views on both the server and the client, use asp.net to create raw JSON data, then pass it to JavaScript, which will use its templates to generate the final HTML structure.

The advantage is that you've already created a reusable service, and your UI logic is all in one place (the client).

However, you don't have to do things this way. You can decide where the best place to create view data.

If your views are all server side (returning HTML from client requests), you might not even need many JMVC views. You would just use controllers. However, controllers are the best part of JMVC. They use event delegation so you don't have to worry about attaching events!

Here's a post where I talk about our architecture with rails:

http://javascriptmvc.com/blog/?p=68

Justin Meyer
Hi Justin, thanks for the reply, this post is quite old now, i have asked many questions in your javascriptmvc forum and although i haven't actually done a asp.net mvc / jmvc together yet - i have managed to get a jmvc app off the ground and working.... I am planning on doing another shortly but i will wait for 2.0 to be released. I managed to get things working with 1.1 with regards to Multi Language characters and utf-8 which i beleive is fixed in 2.0 .... THanks for the comment, although still not an expert on jmvc .. i have come a long way .... I will be back in forums shortly ..
mark smith
2.0 is released. It says beta, but we always wait a week or so before slapping on production.
Justin Meyer