<?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>Routedata on Emad Alashi</title>
    <link>https://emadashi.com/tags/routedata/</link>
    <description>Recent content in Routedata 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/routedata/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>
    <item>
      <title>How Html.Action() Work</title>
      <link>https://emadashi.com/2012/03/how-html-action-work/</link>
      <pubDate>Fri, 23 Mar 2012 15:30:48 +0000</pubDate>
      <guid>https://emadashi.com/2012/03/how-html-action-work/</guid>
      <description>&lt;p&gt;Let’s take the example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-razor&#34; data-lang=&#34;razor&#34;&gt;@Html.Action(&amp;#34;Latest&amp;#34;, &amp;#34;Episode&amp;#34;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;What this will do is to invoke the “&lt;em&gt;Latest&lt;/em&gt;” action method in the “&lt;em&gt;Episode&lt;/em&gt;” controller. But what really happens behind the scenes is NOT a direct invoke; it will actually start from the beginning of the ASP.NET MVC execution pipeline using “&lt;em&gt;Latest&lt;/em&gt;” and “&lt;em&gt;Episode&lt;/em&gt;” as Route values for the keys “&lt;em&gt;action&lt;/em&gt;” and “&lt;em&gt;controller&lt;/em&gt;” respectively.&lt;/p&gt;
&lt;p&gt;This means that you should pay very good attention to your Routes definition in the Application_Start() in Global.asax; Html.Action() will try to match the best route in your defined routes according to the RouteValueDictionary created above (action and controller) along with any additional route values provided in the overload.&lt;/p&gt;</description>
    </item>
    <item>
      <title>QueryString in Routing and Model Binding in ASP.NET MVC</title>
      <link>https://emadashi.com/2012/01/querystring-in-routing-and-model-binding-in-asp-net-mvc/</link>
      <pubDate>Fri, 13 Jan 2012 14:39:57 +0000</pubDate>
      <guid>https://emadashi.com/2012/01/querystring-in-routing-and-model-binding-in-asp-net-mvc/</guid>
      <description>&lt;p&gt;In a nutshell, a query string will not be part of the RouteData dictionary in the routing process, yet it will affect the route matching. On the other hand, when Model Binding takes place, query string will be used to bind to the parameters of the action method, unless there is an item in route data with the same key.&lt;/p&gt;
&lt;p&gt;Now the details. Let us consider this ASP.NET MVC application. We have an action method:&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
