MVC 4 investigating best practices

I’m starting to investigate on the topic. We are looking for improvements on MVCdevelopment.

One point have noticed: improve usability of UI. How to avoid having to jump to other views to realize actions over current object instances?

I think we can help on this problem using partial views and or Ajax. Will keep looking for these alternatives more deeply.

4 thoughts on “MVC 4 investigating best practices

  1. I think one of the secret ingredients is Html Helpers, which can be used in Razor. Imagine a control @Html.DisplayAndEditFor(…) which is a display control, and on hover over the control, it shows an edit link. When clicking the edit link, the control changes to a textbox (same as the one used in @Html.Editfor(..)). A small save link appears next to it, and when clicking save, it will save whatever edited value you put in the textbox by asynchronously POSTing it to the controller – and change back to the display mode. All this wrapped in a HtmlHelper, so the same control can be used for any type of text field, and all that needs to be entered is the model. Another Helper would have to be made for check-boxes, yet another for dropdown lists, and so on.

  2. Very interesting approach, now what you mention will be the small building blocks for the elements of objects (properties of the view models clases). Now, how to arrange those models so it is easy gor usersvto eork with them?

    I tend to prefer a balanced approach, i.e., just a create view with list of existent objects, then, at the list item level, links for oelther views for example edit.

  3. You should try modal forms. Mixing a bit of javascript in the ecuation to bring up a modal form with ajax might do the trick.

    Since you don´t have state in MVC as in Web Forms, components like DataGrid are not availuable, but javascript can do the magic with some nice AJAX comunication. MVC plays nice with ajax.


  4. Great, we are currently using AJAX, javascript and json on one of our projects (actually, we use javascript in other projects to allow using things like TimePicker).

    There is another approach that combines Web API and script blocks, as mentioned at the bookASP.Net MVC 4 Recipes from John Ciliberti, he states this approach makes data available via the Web API and he recommends it when you are going to support mobile devices. Nevertheless, no sample on this approach on the book (sadly). I’ll investigate it as it seems interesting, more if we plan to develop for mobile.

    Best regards.

Leave a Reply

Your email address will not be published. Required fields are marked *