Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8932657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:21:45+00:00 2026-06-15T09:21:45+00:00

I have a model class I created; a simple POCO class: public class ContactModel

  • 0

I have a model class I created; a simple POCO class:

public class ContactModel
{
    [Required]
    public string Name { get; set; }

    [Required]
    public string Email { get; set; }

    [Required]
    public string Message { get; set; }

    [Required]
    public string Work{ get; set; }        
}

Inside a view, I’d like to call and editor for this model:

<div class="contact-form">
    @Html.EditorFor(new Map.WebUI.Models.ContactModel())
</div>

But I get the error:

Compilation Error

Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: CS0411: The type arguments for method
‘System.Web.Mvc.Html.EditorExtensions.EditorFor(System.Web.Mvc.HtmlHelper,
System.Linq.Expressions.Expression>)’
cannot be inferred from the usage. Try specifying the type arguments
explicitly.

Source Error:

How can I invoke an editor for a random class, considering the view is not strongly typed to this object type?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:21:46+00:00Added an answer on June 15, 2026 at 9:21 am

    In your view you set at the top @model Map.WebUI.Models.ContactModel

    Then you need to use the EditorFor this way:

    @Html.EditorFor(x => x.ContactModel())
    

    the parameter is a Lamda Expresion.

    EDIT:

    Ok, I don’t got that you cannot change it… so… I think you cannot use EditorFor.
    But what you CAN do is use a PartialView and use:

    @Html.Partial("YourContactView", new Map.WebUI.Models.ContactModel())
    

    EDIT 2

    You can also use the @Html.Editor(string expression, ViewData data)… that way you can place the Model to pass to the Editor in the ViewData object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple model public class OneModel { public string Email { get;
I have this simple model: class Tag(models.Model): title = models.SlugField() created = models.datetime def
I have a simple Entry class model public class Entry { public int Id
I've created a simple model class Person(models.Model): name = models.CharField(max_length=25) surname = models.CharField(max_length=25) birth_date
I have a simple person public class Person { public virtual string Id {
I have a model with a datetime field: class MyModel(models.Model): created = models.DateTimeField(auto_now =
I have model public class UploadOptionModel { public UploadOptionModel() { OutputFormat = outputFormatList.Select(i =>
I have a simple model: class User < ActiveRecord::Base has_and_belongs_to_many :roles end class Role
I have a simple model class Ad < ActiveRecord::Base has_many :ad_items end class AdItem
I have a simple model: class MyEntry(db.Model): keyName = db.StringProperty() valuesList = db.StringListProperty() and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.