<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Tags/Html.editorfor on Emad Alashi</title>
    <link>https://emadashi.com/tags/html.editorfor/</link>
    <description>Recent content in Tags/Html.editorfor on Emad Alashi</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Sun, 13 May 2012 15:41:40 +0000</lastBuildDate>
    <atom:link href="https://emadashi.com/tags/html.editorfor/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Html.EditorFor, Model Property vs RouteData Value</title>
      <link>https://emadashi.com/2012/05/html-editorfor-model-property-vs-routedata-value/</link>
      <pubDate>Sun, 13 May 2012 15:41:40 +0000</pubDate>
      <guid>https://emadashi.com/2012/05/html-editorfor-model-property-vs-routedata-value/</guid>
      <description>&lt;p&gt;The ASP.NET MVC team made our lives easier when they created the Html editor extension method &lt;em&gt;&lt;a href=&#34;http://msdn.microsoft.com/en-us/library/system.web.mvc.html.editorextensions.editorfor.aspx&#34; target=&#34;_blank&#34;&gt;Html.EditoFor()&lt;/a&gt;;&lt;/em&gt; you just pass the model property and it creates the right editor, filling it with the property’s value…but not always!&lt;/p&gt;
&lt;p&gt;Let’s consider that we have the conventional route definition:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-csharp&#34; data-lang=&#34;csharp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;routes.MapRoute(
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Default&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#75715e&#34;&gt;// Route name&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;{controller}/{action}/{id}&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#75715e&#34;&gt;// URL with parameters&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; { controller = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Home&amp;#34;&lt;/span&gt;, action = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Index&amp;#34;&lt;/span&gt;, id = UrlParameter.Optional } &lt;span style=&#34;color:#75715e&#34;&gt;// Parameter defaults&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;and this simple action method:&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
