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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:18:52+00:00 2026-06-04T02:18:52+00:00

I have read some posts, but I still find it difficult to solve this.

  • 0

I have read some posts, but I still find it difficult to solve this. My problem is that my action only reads some of the values from the binded list. This is how I send the list to the view:

public ActionResult RegisterSurvey()
    {
        RegisterSurveyModel model = new RegisterSurveyModel();

        var questions = new List<QuestionModel>();
        var survey = EFSurvey.Survey.FirstOrDefault();
        survey.QuestionSurvey
            .Where(x => x.AuditingDeleted == false)
            .Where(x => x.Active == true).ToList().ForEach((item) =>
            {
                var questionModel = new QuestionModel();
                ModelCopier.CopyModel(item, questionModel);
                questionModel.Answer = string.Empty;

                questions.Add(questionModel);

            });
        model.Questions = questions;
        return View(model);
    }

This is my model:

public class RegisterSurveyModel
{
    public List<QuestionModel> Questions { get; set; } 
}

public class QuestionModel
{
    public int QuestionSurveyID { get; set; }
    public string Question { get; set; }
    public string Answer { get; set; }
    public bool Suggestion { get; set; }
}

This is my view:

<div class="SiteSurveyContainer">
@using (Html.BeginForm())
{
    <div class="SurveyUp">
        @for (int i = 0; i < Model.Questions.Count(); i++)
        {
            if (!Model.Questions[i].Suggestion)
            {
            <p>@Model.Questions[i].Question</p>
            @Html.HiddenFor(x => Model.Questions[i].QuestionSurveyID);
            @Html.TextBoxFor(x => Model.Questions[i].Answer, new { @class = "surveyBox" });
            }
        }
    </div>
    <div class="SurveyBottom">
        <div class="line">
        </div>
        <p>
            Suggestions</p>
        @for (int i = 0; i < Model.Questions.Where(x => x.Suggestion == true).Count(); i++)
        {
            @Html.HiddenFor(x => Model.Questions[i].QuestionSurveyID);
            @Html.TextAreaFor(x => Model.Questions[i].Answer, new { @class = "surveyTextArea" })
        }
    </div>
    <div class="surveyBottomButton">
        <input type="submit" value="Submit Results" />
    </div>
}

So far so good. Anyway, when I answer all of the survey questions, I only get the first 4 answers… Weird. Anyone knows why is that happening?

enter image description here

  • 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-04T02:18:54+00:00Added an answer on June 4, 2026 at 2:18 am

    You have multiple input controls with within the same form with the same name.

    Suggested questions are a sub set of all questions, so they are being repeated twice on the same form. That will throw off the ModelBinder, so your receiving action is probably only seeing the questions that have not been repeated.

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

Sidebar

Related Questions

I have read some posts in stackoverflow to solve my issue partially, but I
I have already read some posts, but no one helped me with my problem.
I read the forums and some posts here but still couldn't figure this out:
I have read some posts having the same problem. I tried to adapt their
I have read some posts about this topic and the answers are comet, reverse
I have read some articles on POCO in the enttity framework but still don't
I've read all posts about routing and Zend Documentation but I still can't solve
I have read some posts on this website about using drawInRect instead of the
I have read many posts on this, especially here on this site, but I
I've read some posts about namespaces and autoload in php 5.3+, but still haven't

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.