Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes it is. </p> <p>Moreover the default template will render that field exactly as you wrote if you use the Display Html extensions and an associated ViewModel. Just decorate the field in the model with the right DataType attribute</p> <pre><code>[DataType(DataType.EmailAddress)] public string EmailAddress { get; set; } </code></pre> <p>Please see <a href="http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-1-introduction.html" rel="nofollow">this post</a> series for further informations.</p> <p><strong>EDIT</strong>:</p> <p>Suppose you have the following ViewModel</p> <pre><code>public class CustomerModel { public string CustomerName { get; set; } [DataType(DataType.EmailAddress)] public string EmailAddress { get; set; } } </code></pre> <p>and inside your Controller the following Action</p> <pre><code>[HttpGet] public ActionResult ViewCustomer( int id ) { CustomerModel cm = LoadCustomerByID( id ); return View( cm ); } </code></pre> <p>you can have a view named Viewcustomer.aspx that is strong typed to an instance of CustomerModel and just have this code in the view</p> <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&lt;MyApp.CustomerModel&gt;" %&gt; &lt;asp:Content ContentPlaceHolderID="MainContent" runat="server"&gt; &lt;%= Html.DisplayForModel() %&gt; &lt;/asp:Content&gt; </code></pre> <p>Please take a coffe and get time to read that article series. It's very easy and can address more than what I am trying to write in this small post. ;)</p> <p>Hope it helps!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload