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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:51:45+00:00 2026-06-06T10:51:45+00:00

I am trying to create a question and answers page. In which I am

  • 0

I am trying to create a question and answers page. In which I am adding a question through textbox and want to add 4 textboxes to get answer option. I am using this model.

public class Question
    {
        public virtual int ID { get; set; }
        public virtual QPad QPad { get; set; }
        [Display(Name = "Add Question")]
        public virtual string QuestionText { get; set; }        
        [Display(Name = "Add Options")]
        public virtual IList<string> AnswerOption { get; set; }
    }

But now in a create action’s view of QuestionController

My controller is:

[HttpPost]
        public ActionResult Index(int qId, Question ques )
        {
            if (ModelState.IsValid)
            {
                var QPads = _db.QPads.Single(r => r.ID == qId);
                QPads.Questions.Add(ques);
                _db.SaveChanges();
                return RedirectToAction("Index", "QPad");
            }
            else
            {
                return View(ques);
            }
        }

I want to add editor for question text and options, I use

<div class="editor-label">
            @Html.LabelFor(model => model.QuestionText)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.QuestionText)
            @Html.ValidationMessageFor(model => model.QuestionText)
        </div>
/// ?????What for  4 Options boxes///////?

I am not able to add option boxes. Am I using correct approach in models or should I change something ?

or can I customize that user itself select how much options he wants to add ?

Please suggest ?

  • 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-06T10:51:46+00:00Added an answer on June 6, 2026 at 10:51 am

    If the use is always allowed to add four options then I may try something like this.

    <div class="editor-label">
      @Html.LabelFor(model => model.QuestionText)
    </div>
    <div class="editor-field">
      @Html.EditorFor(model => model.QuestionText)
       @Html.ValidationMessageFor(model => model.QuestionText)
    </div>
    @for(int i = 0; i < 4; i++)
    {
      <div class="editor-field">
         @Html.EditorFor(model => model.AnswerOption[i])
         @Html.ValidationMessageFor(model => model.AnswerOption[i])
      </div>
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create simple login/registration page. I'm using index.php which includes login.php in
I am trying to create a database to store some questions and answers for
Question I'm trying to create a basic wxWidgets program with a text entry box,
This is just a simple question. I was trying to create a new object
I'm new in xml, sorry for the dumb question. I'm trying to create xsl
After trying a lot i decided to ask question on stackoverflow, I create a
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
I've been trying to create an order confirmation page for my rails app, and
Basically, i am trying to create a web page that utilises jquery in order
I have a question that I've been trying to answer for some time now

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.