Copied to clipboard

Flag this post as spam?

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


  • Sonja 133 posts 621 karma points
    Sep 10, 2018 @ 10:22
    Sonja
    0

    Problem with partial view

    Hi,

    I'm doing https://our.umbraco.com/documentation/reference/templating/mvc/Forms/tutorial-partial-views and I'm trying to do the partial view `

    @inherits Umbraco.Web.Mvc.UmbracoViewPage
    @using Umbraco.Web.Mvc
    @using UmbracoMVC0.Controllers
    @using Umbraco.Web
    
    @Model UmbracoMVC0.Models.CommentViewModel
    
    @using (Html.BeginUmbracoForm<BlogPostSurfaceController>("CreateComment"))
    {
        @Html.EditorFor(x => Model)
        <input type="submit" />
    }
    

    `

    but on EditorFor I'm gettong error "The type arguments for method 'HtmlHelperRenderExtensions.EditorFor<T>(HtmlHelper, string, string, object) cannot be inferred from the usage. Try specifying the type arguments explicitly." How do I fix this? Do I have some reference missing?

    Thanks

  • Sonja 133 posts 621 karma points
    Sep 11, 2018 @ 04:43
    Sonja
    0

    Did no one go through this training?

  • Paul Seal 524 posts 2889 karma points MVP 7x c-trib
    Sep 12, 2018 @ 15:21
    Paul Seal
    0

    Hi Sonja

    I could be wrong, but I think it should be:

    @Html.EditorFor(x => x)
    

    Kind regards

    Paul

  • Sonja 133 posts 621 karma points
    Sep 13, 2018 @ 04:51
    Sonja
    100

    No I have solved it. I should remove all the references in the view so it would be like

        @using UmbracoMVC0.Controllers
    
    @using (Html.BeginUmbracoForm<BlogPostSurfaceController>("CreateComment"))
    {
        @Html.EditorFor(x => Model)
        <input type="submit" />
    }
    

    and call it from the page with

     @Html.Partial("BlogCommentForm", new CommentViewModel())
    
Please Sign in or register to post replies

Write your reply to:

Draft