MVC

There are 10 entries for the tag MVC
Json serialization – RPC style in MVC
In a previous posting, I discussed replacing the stock MVC serializer used for the JsonResult exposed when you use the controller method Json(..) instead of View. This was all find and dandy. But how – you may wonder – can I call actions that contain complex parameters? Do I need a special binder? Should I write my own? The answer is mostly "no". As Phil Hack blogged, the ASP.NET MVC framework already contains value providers that take care of that for you. All you need to do is ensure that your ......

Posted On Monday, January 16, 2012 6:42 PM | Comments (0)

JSON serialization problems and solution in MVC3
For various reasons you may find that the default JsonResult returned by invoking the controller method such as return Json([data); Is unsuitable for the consumer. The main issue most often encountered is that this method uses the JsonResult which in turn uses the JavaScriptSerializer with no access to the JavaScriptTypeResolver. This means that you can provide that serializer a parameter specifying you own custom type resolver. Other issues, such as maximum recursion depth and maximum length and ......

Posted On Wednesday, January 11, 2012 7:07 PM | Comments (0)

The last MVVM you'll ever need?
As my MVC projects mature and grow, the need to have some omnipresent, ambient model properties quickly emerge. The application no longer has only one dynamic pieced of data on the page: A sidebar with a shopping cart, some news flash on the side – pretty common stuff. The rub is that a controller is invoked in context of a single intended request. The rest of the data, even though it could be just as dynamic, is expected to appear on it's own. There are many solutions to this scenario. MVVM prescribes ......

Posted On Tuesday, May 18, 2010 2:15 AM | Comments (0)

MVC Automatic Menu
An ex-colleague of mine used to call his SQL script generator "Super-Scriptmatic 2000". It impressed our then boss little, but was fun to say and use. We called every batch job and script "something 2000" from that day on. I'm tempted to call this one Menu-Matic 2000, except it's waaaay past 2000. Oh well. The problem: I'm developing a bunch of stuff in MVC. There's no PM to generate mounds of requirements and there's no Ux Architect to create wireframe. During development, things change. Specifically, ......

Posted On Monday, March 22, 2010 6:17 AM | Comments (7)

Fluent Binder – Simple Magic can happen in 10 lines of C#
Often enough we have frameworks do heavy lifting for us. That's usually a good thing. But I always found it kind of sedating to let "the man" provide me with too much comfort. Especially when the framework or other SOUP library fails to perform exactly what you want. That usually leads to some grumpiness followed by some code-acrobatics to punch that square peg into a round hole – often negating the elegance and usefulness of the library call altogether. One task a framework often performs is binding. ......

Posted On Monday, November 30, 2009 1:10 AM | Comments (0)

MVC Radio Button List
As predicted, I came around to using some radio buttons. As you might guess by now, I didn't like the HTML or the implementation in the current MVC release. As you may expect, I wrote my own :-) The implementation is fairly simple and straightforward. It extends System.Web.MVC.ViewPage, takes a list of objects, allows for selection of one of the radio buttons, supports orientation and supports selection of both the value the radio button submits and the display string for that item independently. ......

Posted On Wednesday, August 5, 2009 7:29 PM | Comments (3)

MVC paged list
The need As certain as the sun rising tomorrow, there will come the point where you will want to display a list or grid with paging. While many solutions exist, and many component developers are coming in with robust solutions, a simple and satisfactory solution can be created fairly easily. Implementation Why create a pager from scratch? Several reasons: 1) You want to control the pager completely – display, style and all. 2) You don't like the idea of JavaScript paging, which will load your hundreds ......

Posted On Wednesday, August 5, 2009 2:16 PM | Comments (17)

MVC + ASP.Net template control and user control
Seeing that I can use a DataBoundControl such as DataList, and binding it to a source control is achievable – what next? Data bound controls contain various templates. The usual suspects are the item template and alternating template (for a repeating object, with possible varied style), the header and the footer templates (for enclosing HTML pre/post wrap or header / footer effects). Under MVC, all events are out the window. So we're not concerned at all with event hookup. We might want to provide ......

Posted On Friday, July 24, 2009 9:37 PM | Comments (0)

MVC, helpers and classic ASP.NET data bound controls – Better Together
Technorati Tags: MVC,ASP.NET,Extension Methods,Html Helper A lot of hype around MVC these days. So, of course, yours truly is working on some project utilizing MVC. While brushing the dust off my raw HTML tag memory and designing the obvious: lists, grids, repeated item displays and the such, I thought "why not use the asp.net controls instead?" For one, most of the ASP.NET data bound controls have a rich site of event post backs to hook up. MVC says: no dice! You can't rely on the event dispatch ......

Posted On Tuesday, July 7, 2009 8:14 PM | Comments (4)

Localize your MVC with ease.
MVC seems all the rage these days. And while there are many good things it brings to the table, it seams it takes us a step back in terms of I18N. For instance, if you want to use the special aspx attribute meta:resourceKey="foo", you won't always be able to do so. The following would work fine: 1: <asp:Label runat="server" ID="_QueryPrompt" Text="Enter Query" meta:resourcekey="_QueryPro... />&nbsp; But we're out of luck with buttons: 1: <asp:Button runat="server" ID="btn" Text="Run" ......

Posted On Sunday, June 7, 2009 10:08 PM | Comments (1)