<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ASP.NET MVC 2 Templates</title>
	<atom:link href="http://www.dalsoft.co.uk/blog/index.php/2010/04/26/mvc-2-templates/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dalsoft.co.uk/blog/index.php/2010/04/26/mvc-2-templates/</link>
	<description>Dalsoft&#039;s Blog</description>
	<lastBuildDate>Sat, 03 Dec 2011 15:24:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Gene Osteen</title>
		<link>http://www.dalsoft.co.uk/blog/index.php/2010/04/26/mvc-2-templates/comment-page-1/#comment-3032</link>
		<dc:creator>Gene Osteen</dc:creator>
		<pubDate>Wed, 21 Sep 2011 20:00:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.dalsoft.co.uk/blog/?p=514#comment-3032</guid>
		<description>I&#039;m stuck at trying to add the calendar. I keep getting the below error every time I add the DateTime View to the Editor Templates. when I remove the view everything works fine.

{&quot;The model item passed into the dictionary is null, but this dictionary requires a non-null model item of type &#039;System.DateTime&#039;.&quot;}</description>
		<content:encoded><![CDATA[<p>I&#8217;m stuck at trying to add the calendar. I keep getting the below error every time I add the DateTime View to the Editor Templates. when I remove the view everything works fine.</p>
<p>{&#8220;The model item passed into the dictionary is null, but this dictionary requires a non-null model item of type &#8216;System.DateTime&#8217;.&#8221;}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Some links for 2011-05-20 at The Standard Output</title>
		<link>http://www.dalsoft.co.uk/blog/index.php/2010/04/26/mvc-2-templates/comment-page-1/#comment-2444</link>
		<dc:creator>Some links for 2011-05-20 at The Standard Output</dc:creator>
		<pubDate>Fri, 20 May 2011 18:28:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.dalsoft.co.uk/blog/?p=514#comment-2444</guid>
		<description>[...] Blog jQuery plugin: Tablesorter 2.0 DataTables (table plug-in for jQuery) jQuery Grid Plugin ASP.NET MVC 2 Templates Take a Mulligan with Redo Backup &amp; Recovery &#124; Linux Magazine www.Visual6502.org MetaSharp [...]</description>
		<content:encoded><![CDATA[<p>[...] Blog jQuery plugin: Tablesorter 2.0 DataTables (table plug-in for jQuery) jQuery Grid Plugin ASP.NET MVC 2 Templates Take a Mulligan with Redo Backup &amp; Recovery | Linux Magazine <a href="http://www.Visual6502.org" rel="nofollow">http://www.Visual6502.org</a> MetaSharp [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marshall</title>
		<link>http://www.dalsoft.co.uk/blog/index.php/2010/04/26/mvc-2-templates/comment-page-1/#comment-1340</link>
		<dc:creator>Marshall</dc:creator>
		<pubDate>Tue, 23 Nov 2010 20:10:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.dalsoft.co.uk/blog/?p=514#comment-1340</guid>
		<description>What if you wanted to add to the list of Offices instead of selecting an existing one on the same view?  How do you display a text boxs for Office Address and Country?

Thanks,
-Marshall</description>
		<content:encoded><![CDATA[<p>What if you wanted to add to the list of Offices instead of selecting an existing one on the same view?  How do you display a text boxs for Office Address and Country?</p>
<p>Thanks,<br />
-Marshall</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ranco</title>
		<link>http://www.dalsoft.co.uk/blog/index.php/2010/04/26/mvc-2-templates/comment-page-1/#comment-1154</link>
		<dc:creator>Ranco</dc:creator>
		<pubDate>Fri, 15 Oct 2010 11:12:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.dalsoft.co.uk/blog/?p=514#comment-1154</guid>
		<description>The first template (partial view) is inherited from ViewUserControl.

&lt;%@ Control Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewUserControl&quot; %&gt;  
...

However, the String template is not only used for strings, but for all simple types (if not overridden).

See the tutorial &#039;ASP.NET MVC 2 Templates, Part 3: Default Templates&#039; at http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-3-default-templates.html and especially Richard Folland&#039;s comment.

Removing the generic argument  from the first line of the template resolves this issue.</description>
		<content:encoded><![CDATA[<p>The first template (partial view) is inherited from ViewUserControl.</p>
<p>&lt;%@ Control Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewUserControl&#8221; %&gt;<br />
&#8230;</p>
<p>However, the String template is not only used for strings, but for all simple types (if not overridden).</p>
<p>See the tutorial &#8216;ASP.NET MVC 2 Templates, Part 3: Default Templates&#8217; at <a href="http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-3-default-templates.html" rel="nofollow">http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-3-default-templates.html</a> and especially Richard Folland&#8217;s comment.</p>
<p>Removing the generic argument  from the first line of the template resolves this issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roberto</title>
		<link>http://www.dalsoft.co.uk/blog/index.php/2010/04/26/mvc-2-templates/comment-page-1/#comment-1150</link>
		<dc:creator>Roberto</dc:creator>
		<pubDate>Wed, 13 Oct 2010 09:12:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.dalsoft.co.uk/blog/?p=514#comment-1150</guid>
		<description>Great article, DalSoft! Thank you.

One problem though: when I supply an instance of EmployeeModel to the View, an exception is raised:

The model item passed into the dictionary is of type &#039;System.Int32&#039;, but this dictionary requires a model item of type &#039;System.String&#039;.

I would expect the Int32 property to default to the default editor (i.e. the build in editor).

      [HttpGet]
      public ActionResult Index()
      {
         return View(
            new EmployeeModel
               {
                  Id = 12
               });
      }

Btw, is it possible to override the selection of templates. It would be nice if various datetime pickers could be used (depending on the user&#039;s preferences).

Ciao</description>
		<content:encoded><![CDATA[<p>Great article, DalSoft! Thank you.</p>
<p>One problem though: when I supply an instance of EmployeeModel to the View, an exception is raised:</p>
<p>The model item passed into the dictionary is of type &#8216;System.Int32&#8242;, but this dictionary requires a model item of type &#8216;System.String&#8217;.</p>
<p>I would expect the Int32 property to default to the default editor (i.e. the build in editor).</p>
<p>      [HttpGet]<br />
      public ActionResult Index()<br />
      {<br />
         return View(<br />
            new EmployeeModel<br />
               {<br />
                  Id = 12<br />
               });<br />
      }</p>
<p>Btw, is it possible to override the selection of templates. It would be nice if various datetime pickers could be used (depending on the user&#8217;s preferences).</p>
<p>Ciao</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DalSoft</title>
		<link>http://www.dalsoft.co.uk/blog/index.php/2010/04/26/mvc-2-templates/comment-page-1/#comment-1068</link>
		<dc:creator>DalSoft</dc:creator>
		<pubDate>Thu, 23 Sep 2010 22:14:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.dalsoft.co.uk/blog/?p=514#comment-1068</guid>
		<description>Yes change the DateTime template, add the buttonImage parameter to the datepicker function example below:

 $(document).ready(function() {  
   
         $(&quot;&lt;%=id%&gt;&quot;).datepicker({  
             showOn: &#039;both&#039;,
             buttonImage: &quot;images/calendar.gif&quot;,  
             dateFormat: &#039;dd M yy&#039;,  
             changeMonth: true,  
             changeYear: true  
         });  
     });</description>
		<content:encoded><![CDATA[<p>Yes change the DateTime template, add the buttonImage parameter to the datepicker function example below:</p>
<p> $(document).ready(function() {  </p>
<p>         $(&#8220;< %=id%>&#8220;).datepicker({<br />
             showOn: &#8216;both&#8217;,<br />
             buttonImage: &#8220;images/calendar.gif&#8221;,<br />
             dateFormat: &#8216;dd M yy&#8217;,<br />
             changeMonth: true,<br />
             changeYear: true<br />
         });<br />
     });</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DalSoft</title>
		<link>http://www.dalsoft.co.uk/blog/index.php/2010/04/26/mvc-2-templates/comment-page-1/#comment-1065</link>
		<dc:creator>DalSoft</dc:creator>
		<pubDate>Thu, 23 Sep 2010 20:16:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.dalsoft.co.uk/blog/?p=514#comment-1065</guid>
		<description>Hi Daniel thanks for your feedback. 

I agree, but I wrote the examples in .NET 3.5 as I wrote this post just before .NET 4 went RTM (&lt;%: is a .NET 4 feature). My &lt;a href=&quot;http://www.dalsoft.co.uk/blog/index.php/2010/07/29/asp-net-mvc-2-template-helpers-allow-you-to-specify-extra-view-data&quot; rel=&quot;nofollow&quot;&gt;latest update&lt;/a&gt; to the post uses &lt;%:</description>
		<content:encoded><![CDATA[<p>Hi Daniel thanks for your feedback. </p>
<p>I agree, but I wrote the examples in .NET 3.5 as I wrote this post just before .NET 4 went RTM (< %: is a .NET 4 feature). My <a href="http://www.dalsoft.co.uk/blog/index.php/2010/07/29/asp-net-mvc-2-template-helpers-allow-you-to-specify-extra-view-data" rel="nofollow">latest update to the post uses <%:</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Liuzzi</title>
		<link>http://www.dalsoft.co.uk/blog/index.php/2010/04/26/mvc-2-templates/comment-page-1/#comment-1017</link>
		<dc:creator>Daniel Liuzzi</dc:creator>
		<pubDate>Mon, 13 Sep 2010 06:25:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.dalsoft.co.uk/blog/?p=514#comment-1017</guid>
		<description>DalSoft,

Great article with lots of useful information. A little nitpick: the preferred nugget to use in MVC 2.0 uses the colon instead of equal sign. (i.e. instead of  (my apologies if WordPress strips the angle brackets). Equal sign nuggets are no longer recommended, because they are vulnerable to XSS attacks if you forget to encode your output. By using the colon instead of the equal sign, encoding is done automatically for you, so no more ugly Html.Encode()&#039;s on your views.

Cheers.</description>
		<content:encoded><![CDATA[<p>DalSoft,</p>
<p>Great article with lots of useful information. A little nitpick: the preferred nugget to use in MVC 2.0 uses the colon instead of equal sign. (i.e. instead of  (my apologies if WordPress strips the angle brackets). Equal sign nuggets are no longer recommended, because they are vulnerable to XSS attacks if you forget to encode your output. By using the colon instead of the equal sign, encoding is done automatically for you, so no more ugly Html.Encode()&#8217;s on your views.</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DalSoft</title>
		<link>http://www.dalsoft.co.uk/blog/index.php/2010/04/26/mvc-2-templates/comment-page-1/#comment-812</link>
		<dc:creator>DalSoft</dc:creator>
		<pubDate>Thu, 12 Aug 2010 09:57:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.dalsoft.co.uk/blog/?p=514#comment-812</guid>
		<description>You don&#039;t need to use magic strings with templates when dealing with non complex types, just simply name the template DateTime.ascx. For complex types you can use the DataType attribute as described in the post.

For example Html.EditorFor(model =&gt; model.MyDateTimeProperty) works when you name your template DateTime.ascx convention over configuration takes over and the template is selected using the property&#039;s type name.

Writing your own html helper extension is a solution, but you are rendering html/javascript using code which could be problematic, for example you will need to write a helper to replace each template, rather than using simple mark-up in a template. 

I personally like the flexibility of being able to change templates easily by dropping files into the DisplayTemplates or EditorTemplates folder whenever I want to change how my Model&#039;s properties are displayed. In the end though I guess it&#039;s a matter of taste and what works for your situation.</description>
		<content:encoded><![CDATA[<p>You don&#8217;t need to use magic strings with templates when dealing with non complex types, just simply name the template DateTime.ascx. For complex types you can use the DataType attribute as described in the post.</p>
<p>For example Html.EditorFor(model => model.MyDateTimeProperty) works when you name your template DateTime.ascx convention over configuration takes over and the template is selected using the property&#8217;s type name.</p>
<p>Writing your own html helper extension is a solution, but you are rendering html/javascript using code which could be problematic, for example you will need to write a helper to replace each template, rather than using simple mark-up in a template. </p>
<p>I personally like the flexibility of being able to change templates easily by dropping files into the DisplayTemplates or EditorTemplates folder whenever I want to change how my Model&#8217;s properties are displayed. In the end though I guess it&#8217;s a matter of taste and what works for your situation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://www.dalsoft.co.uk/blog/index.php/2010/04/26/mvc-2-templates/comment-page-1/#comment-808</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Wed, 11 Aug 2010 20:58:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.dalsoft.co.uk/blog/?p=514#comment-808</guid>
		<description>What if you create an html helper extension for the EditorFor(model =&gt; model.Property, &quot;MyCustomEditor&quot;)

For example, you have to render a date picker, instead of call EditorFor(...) for the date picker, you call Html.DatePickerFor(...)

... DatePickerFor(...)
{
    return EditorFor(..., &quot;DatePicker&quot;)
}

This will keep the magic string to a minimum and is much nicer for other developers to use.  What are your thoughts on this?</description>
		<content:encoded><![CDATA[<p>What if you create an html helper extension for the EditorFor(model =&gt; model.Property, &#8220;MyCustomEditor&#8221;)</p>
<p>For example, you have to render a date picker, instead of call EditorFor(&#8230;) for the date picker, you call Html.DatePickerFor(&#8230;)</p>
<p>&#8230; DatePickerFor(&#8230;)<br />
{<br />
    return EditorFor(&#8230;, &#8220;DatePicker&#8221;)<br />
}</p>
<p>This will keep the magic string to a minimum and is much nicer for other developers to use.  What are your thoughts on this?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic (Requested URI is rejected)
Database Caching 6/19 queries in 0.016 seconds using disk: basic
Object Caching 378/389 objects using disk: basic

Served from: www.dalsoft.co.uk @ 2012-02-08 02:21:41 -->
