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 8560711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:20:21+00:00 2026-06-11T16:20:21+00:00

I’m having trouble with MVC4 not being able to bind to anything. For Example:

  • 0

I’m having trouble with MVC4 not being able to bind to anything.

For Example:

    public class Question
    {
    [Key]
    [Required]
    public Int32 QuestionID { get; set; }

    [Required]
    public Int32 SurveyID { get; set; }

    [Required]
    public Int32 QuestionNumber { get; set; }

    [Required]  
    public Boolean AssignedToAPage { get; set; }
    }

I create a strongly typed view using Add View and select the above class:

    @model Models.Question

    @{
       ViewBag.Title = "View1";
       Layout = "~/Views/Layouts/_Site.Layout.cshtml";
    }

<h2>View1</h2>

@using (Html.BeginForm()) {
@Html.ValidationSummary(true)

<fieldset>
    <legend>Question</legend>

    <div class="editor-label">
        @Html.LabelFor(model => model.SurveyID)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.SurveyID)
        @Html.ValidationMessageFor(model => model.SurveyID)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.QuestionNumber)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.QuestionNumber)
        @Html.ValidationMessageFor(model => model.QuestionNumber)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.AssignedToAPage)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.AssignedToAPage)
        @Html.ValidationMessageFor(model => model.AssignedToAPage)
    </div>

    <p>
        <input type="submit" value="Create" />
    </p>
</fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

So, after generating this page, I try going to it and I get the following error:
Compiler Error Message: CS1061: ‘object’ does not contain a definition for ‘SurveyID’ and no extension method ‘SurveyID’ accepting a first argument of type ‘object’ could be found (are you missing a using directive or an assembly reference?)

Is this just an issue with Visual Studio 2012 RC? Do I need to reinstall something? I’ve googled this issue a view times but I’ve yet to find anything relevant. I’ve resorted to explicitly casting Model to the type but that seems to defeat the purpose of having @model. Any input would be useful! Thanks.

Update

Apparently I caused the issue by following someone else's advice on creating a custom view page class.  I created the following: 

public abstract class CustomWebViewPage : WebViewPage
{
    public ContentVersionHelper ContentVersion { get; set; }
    public override void InitHelpers()
    {
        base.InitHelpers();
        ContentVersion = new ContentVersionHelper(base.ViewContext, this);
    }
}

public abstract class CustomWebViewPage<TModel> : WebViewPage
    where TModel : class
{
    public ContentVersionHelper<TModel> ContentVersion { get; set; }
    public override void InitHelpers()
    {
        base.InitHelpers();
        ContentVersion = new ContentVersionHelper<TModel>(base.ViewContext, this);
    }
}

Didn’t even taken into consideration that I needed to derive from WebViewPage on the 2nd class. After adding that, everything was fixed. Thanks for the assistance.

  • 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-11T16:20:22+00:00Added an answer on June 11, 2026 at 4:20 pm

    The custom classes should be updated to match the following:

    public abstract class CustomWebViewPage : WebViewPage
    {
        public ContentVersionHelper ContentVersion { get; set; }
        public override void InitHelpers()
        {
            base.InitHelpers();
            ContentVersion = new ContentVersionHelper(base.ViewContext, this);
        }
    }
    
    public abstract class CustomWebViewPage<TModel> : WebViewPage<TModel>
        where TModel : class
    {
        public ContentVersionHelper<TModel> ContentVersion { get; set; }
        public override void InitHelpers()
        {
            base.InitHelpers();
            ContentVersion = new ContentVersionHelper<TModel>(base.ViewContext, this);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
This could be a duplicate question, but I have no idea what search terms
I don't have much knowledge about the IPv6 protocol, so sorry if the question
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.