views:

183

answers:

1

I'm currently writing a small application for use internally at my office. I started out teaching myself some MVC (I've been a C# dev for 3 years). One of the main requirements is editable grids - I quickly realised that silverlight (i have zero silverlight experience) could be a big help in this. I've managed to create a proof of concept of getting MVC and silverlight to talk back an forth by combining these two techniques: Creating a Rest API using MVC
MVC SilverLight
I also got some help on stackoverflow:
silverlight-grids-mvc-http-post

Essentially all I'm doing is embedding a silver light object in a view. Serializing the Model data as JSON and passing it to silverlight(using intit params written into the response). The silverlight object can post data back to the controller as JSON.

So far this seems like it could work quite well. However I am a bit concerned that I could be painting myself into a corner with this approach, as in I don't have much experience with either technology so I'm worried I'm going get hit with something further down the line that I won't be able to work around. Has anybody else tried doing this? Any advice would be much appreciated!

+1  A: 

I am using silverlight with ASP.NET MVC 2 for a few things that are just easier in Silverlight. At first I thought it was wrong to combine a stateless framework with a state-dependent framework but it can certainly work nicely. If your app is mostly Silverlight you might not want to use MVC for it, but if you just use Silverlight when it is the right tool for the job I think it works great.

You should not come into any problems that will just not work using the two technologies. You can send data to and from Silverlight from MVC, so you can send your JSON result if you like. You can even embed a Silverlight object in a partial view like you discussed. You can use http handlers to process your Silverlight data. There's not much more to it.

Yesterday I even wrote a blog post about using ASP.NET MVC 2 and Silverlight together and how to make that a little more intuitive for people who are more familiar with the coding style in MVC. You are welcome to look at that if you do decide to go with Silverlight in MVC.

Steve Hook