score:2

Accepted answer

Instead of:

<%=Html.DisplayFor(x => x.MatrixColumns[matrixColumnView.Key].DataTypeName, (string)matrixColumnView.Value.DataTypeName) %>

Just try:

<%=Html.DisplayFor(x => x.MatrixColumns[matrixColumnView.Key].DataTypeName) %>

By passing in (string)matrixColumnView.Value.DataTypeName - which (presumably) evaluates to "Boolean" - as the second argument, you are telling MVC to look for a display template called "Boolean." Obviously, the template it finds can't display String values. Usually, you're better off letting the framework decide which display template to use.

There's a useful article here that talks about how MVC resolves display/editor templates:

http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-3-default-templates.html


Related Articles