Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David 6 posts 28 karma points
    Mar 05, 2013 @ 22:28
    David
    0

    MVC EditorTemplates

    I haven't seen this brought up yet (only in some obscure v5 post that was never answered) but what about EditorTemplates. In MVC they live under Views\Shared\EditorTemplates. I've tried to use them but nothing... I'm still new to MVC and Umbraco + MVC but this is something that seems like it would come in handy! 

    Edit to add:

    @using (Html.BeginUmbracoForm<GD.Umbraco.Controllers.FormsController>("Newsletter"))
    {
        @Html.EditorFor(x=>Model)
        <input type="submit" />
    }

    Would ideally produce my templated Textbox from Views\Shared\EditorTemplates\String.cshtml
    Stackoverflow I used to do this : http://stackoverflow.com/questions/5824124/html5-placeholders-with-net-mvc-3-razor-editorfor-extension

     

  • David 6 posts 28 karma points
    Mar 05, 2013 @ 22:39
    David
    0

    Well do I have egg on my face.... It DOES work! 

    My model looked like this:

    public class NewsletterModel

        {
          [Required]
          [EmailAddress]
          [Display(Prompt = "Email Address")]
          public string Email { get; set; }
       }

    Having the Attribute [EmailAddress] caused a different Editor Template to be called. Once I removed it the proper template went through! 

    Sorry! Hopefully this helps someone out though! Not an Umbraco issue so if I need to delete it, I will.

Please Sign in or register to post replies

Write your reply to:

Draft