title: ASP.Net MVC custom datatype passing additional values
body: <p>I have created the custom "DataType" annotation to use on the model object to tell this is the date field on the view. (<code>[DataType("Date")]</code>) If I use <code>@Html.EditorFor(model =&gt; model.DateCreated)</code>, it will act as a date field and pup up the JavaScript date picker. This is the template I am using under EditorTemplates</p>
  
  <pre><code>@inherits System.Web.Mvc.WebViewPage&lt;DateTime&gt; 
  &lt;div class="input-append date" data-date="12-02-2012"&gt;
      &lt;input type="text" class="span2"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>View - </p>
  
  <pre><code>&lt;div class="control-group"&gt;
          @Html.LabelFor(model =&gt; model.DateCreated, new { @class = "control-label" })
          &lt;div class="controls" id="date-container"&gt;
              @Html.EditorFor(model =&gt; model.DateCreated, new { @class="input-append date"})
              @Html.ValidationMessageFor(model =&gt; model.DateCreated, null, new { @class = "help-inline" })
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Model - </p>
  
  <pre><code>[Display(Name = "Date Created")]
  [DataType("Date")]        
  public DateTime DateCreated { get; set; }
  </code></pre>
  
  <p>Controller - </p>
  
  <pre><code>public ActionResult Create(int id)
  {
        // Attempt to get new customer object
        GetPaymentResponse paymentResponse = _BillingService.GetPayment(id);
  
       // Check whether response was successful
       if (paymentResponse.State == BaseResponseState.Valid)
       {              
            paymentResponse.Payment.Type.AvailableOptions = paymentResponse.Payment.Type.AvailableOptions.Where(x =&gt; x.Value != "BalancingTransaction").ToList();
            ViewData.Model = paymentResponse.Payment;
            return View();
       }           
  }
  </code></pre>
  
  <p>I need to pass some additional value to my view via datatype from the model. </p>
  
  <p>E.g. <code>[DataType("Date"), Format("dd/mm/yy"), StartDate("12-02-2012")]</code>  </p>
  
  <p>Could you please let me know how can I grab these additional value from the template? (I am new to ASP.Net MVC and I am using MVC 3)</p>
  
  <p>Thanks</p>