title: How to bind view model property with different name
body: <p><strong>Is there a way to make a reflection for a view model property as an element with different name and id values on the html side.</strong></p>
  
  <p>That is the main question of what I want to achieve. So the basic introduction for the question is like:</p>
  
  <p>1- I have a view model (as an example) which created for a filter operation in view side.</p>
  
  <pre><code>public class FilterViewModel
  {
      public string FilterParameter { get; set; }
  }
  </code></pre>
  
  <p>2- I have a controller action which is created for GETting form values(here it is filter)</p>
  
  <pre><code>public ActionResult Index(FilterViewModel filter)
  {
  return View();
  }
  </code></pre>
  
  <p>3- I have a view that a user can filter on some data and sends parameters via querystring over form submit.</p>
  
  <pre><code>@using (Html.BeginForm("Index", "Demo", FormMethod.Get))
  {    
      @Html.LabelFor(model =&gt; model.FilterParameter)
      @Html.EditorFor(model =&gt; model.FilterParameter)
      &lt;input type="submit" value="Do Filter" /&gt;
  }
  </code></pre>
  
  <p>4- And what I want to see in rendered view output is </p>
  
  <pre><code>&lt;form action="/Demo" method="get"&gt;
      &lt;label for="fp"&gt;FilterParameter&lt;/label&gt;
      &lt;input id="fp" name="fp" type="text" /&gt;
      &lt;input type="submit" value="Do Filter" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>5- And as a solution I want to modify my view model like this:</p>
  
  <pre><code>public class FilterViewModel
  {
      [BindParameter("fp")]
      [BindParameter("filter")] // this one extra alias
      [BindParameter("param")] //this one extra alias
      public string FilterParameter { get; set; }
  }
  </code></pre>
  
  <p>So the basic question is about BindAttribute but the usage of complex type properties. But also if there is a built in way of doing this is much better. 
  Built-in pros:</p>
  
  <p>1- Usage with TextBoxFor, EditorFor, LabelFor and other strongly typed view model helpers can understand and communicate better with each other.</p>
  
  <p>2- Url routing support </p>
  
  <p>3- No framework by desing problems :</p>
  
  <blockquote>
    <p>In general, we recommend folks don’t write custom model binders
    because they’re difficult to get right and they’re rarely needed. The
    issue I’m discussing in this post might be one of those cases where
    it’s warranted.</p>
  </blockquote>
  
  <p><a href="http://haacked.com/archive/2011/03/19/fixing-binding-to-decimals.aspx/" rel="noreferrer">Link of quote</a></p>
  
  <p>And also after some research I found these useful works:</p>
  
  <p><a href="https://stackoverflow.com/questions/4316301/asp-net-mvc-2-bind-a-models-property-to-a-different-named-value">Binding model property with different name</a></p>
  
  <p><a href="http://ole.michelsen.dk/blog/bind-a-model-property-to-a-different-named-query-string-field/" rel="noreferrer">One step upgrade of first link</a></p>
  
  <p><a href="https://stackoverflow.com/questions/8507699/how-to-bind-url-parameters-to-model-properties-with-different-names">Here some informative guide</a></p>
  
  <p>Result: But none of them give me my problems exact solution. I am looking for a strongly typed solution for this problem. Of course if you know any other way to go, please share.</p>
  
  <hr>
  
  <p><strong>Update</strong></p>
  
  <p>The underlying reasons why I want to do this are basically:</p>
  
  <p>1- Everytime I want to change the html control name then I have to change PropertyName at compile time. (There is a difference Changing a property name between changing a string in code)</p>
  
  <p>2- I want to hide (camouflage) real property names from end users. Most of times View Model property names same as mapped Entity Objects property names. (For developer readability reasons)</p>
  
  <p>3- I don't want to remove the readability for developer. Think about lots of properties with like 2-3 character long and with mo meanings.</p>
  
  <p>4- There are lots of view models written. So changing their names are going to take more time than this solution.</p>
  
  <p>5- This is going to be better solution (in my POV) than others which are described in other questions until now.</p>