aspConf 2012

Modern Web Development

Download this episode

Download Video

Description

In this talk, Shawn will walk the attendees through the new way that web applications are being built today using the latest in client-side development the best practices of how to carry that out with ASP.NET MVC.

Day:

1

Level:

200

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • Andrew Liang

      Thanks for the great video. Your clarity and elegance matches Scott Hanselman's. :)

      You have mapped your javascript initialization code to your view and controller. However, using this pattern, how would we implement views and javascipt code that are shared by two controllers? We would require two javascript files with virtually the same code. For example, if you have two controllers, Home and Account, and they both have an Index view that require the same javascript code, then two files need to be created that have the same code (ie: Home-Index.js and Account-Index.js) with the exception that they will be created with different object names.

      Most of the javascript code I have written/read, from my experience, are designed to work very closely with the view file and the model that's passed from the controller to the view. In my opinion, the javascript code shouldn't care what controller is used.

    • swildermuth

      Thanks Andrew. As far as the controller/view pattern I am using here. The goal of the home-index.js pattern is to quickly implement the initialization for a page. It is common for me to have the same underlying implementation called by both pages. So in your example, I'd simply put the code that two pages share in a JavaScript 'class' or 'module' and call from each initializer.

    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.