Loading user information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading user information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Client-side Model-View-Presenter

9 minutes, 57 seconds


Right click “Save as…”

The model-view-presenter pattern is a very powerful way to manage user interaction. It seems popular to use it on the server-side when creating HTML, but why not use it client-side instead?
Our computers are powerful enough to run fairly complex JavaScript. Why burden the server with having to render the page contents?

In this screencast I use Script# to compile a C# project into JavaScript. This project contains the Model, View and Presenter logic.
The HTML page then uses the generated JavaScript.

There is a simple REST service on the server that returns data which is called by the Model. No HTML generation occurs on the server.

Download the source code. You must have Script# installed as well.

Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
  • Jonathan MerriweatherCyonix Me
    Thanks for the screencast, i'm going to take a closer look into Script#.

    Have you had a look at ProMesh.Net?

    I realise ProMesh is a server side MVC framework but still thought you might be interested in it...
  • Andrew DaveyAndrew Davey www.​aboutcode.​net
    Seeing as client-side MVP is viable, the next step would be create a framework to reduce some of the boiler-plate coding required. For example, the View class that basically maps to and from DOM elements could probably be code generated.

    Thanks for the link to ProMesh.NET, I like the use of attributes making the whole process much more declarative. I'll certainly be considering similar approachs when expanding my client-side MVP framework.
  • Nice job Andrew!
  • Andrew DaveyAndrew Davey www.​aboutcode.​net

    So I reckon phase two is to use my tier-splitting macro to enable certain model methods to be decorated with [RunAtServer] attributes.
    The macro would do all the plumbing to call the server and execute the model there. This would allow a totally seemless Model class to be written. With the client part ending up in JavaScript and the server part being C#.

  • Andrew:

    The last post is from September.... just wanted to know how did you do with this design?
    You mentioned you was doing a project, how did it go?
    Is there an updated version of the framework?


Remove this comment

Remove this thread


Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.