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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:45:32+00:00 2026-06-04T08:45:32+00:00

I do some webpage under MVC3 and I got some stuck about the best

  • 0

I do some webpage under MVC3 and I got some stuck about the best way to generate HTML controls for the questionnaire.

I guess there are 2 ways:

  1. by code to generate raw html with controls and etc. (I mean like sb.Append("<input id='bla' class='bla' />") and etc.. Sample is here )
  2. by sending the complete model and then put some foreach inside of HTML code

Could u suggest please which way is better and how do I have to get the answers then (by model or FormCollection)?

Here is my draft for the loop (no other things yet…)

var qs = db.SN_Questionnaires.Where(q => q.Code == 1).FirstOrDefault();    
foreach (var questionGroup in qs.SN_QuestionGroups)
    {
        foreach (var question in questionGroup.SN_Questions)
        {
            var questionType = db.SN_QuestionTypes.Where(qt => qt.ID == question.SN_QuestionTypeID).FirstOrDefault(); // Get type of the control here (TextBox, Radio, and etc)

            foreach (var answer in question.SN_Answers)
            {

            }
        }
    }
  • 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-04T08:45:33+00:00Added an answer on June 4, 2026 at 8:45 am

    Have you thought about using partial views? Your model could contain the name of the partial view (your template), and be rendered like this:

    @Html.Partial(Model.Template)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My question is this. There are some texts,reports written on the webpage under the
I have some localization problems in my webpage. There are basically two problems (that
I want to get some images from a flash webpage and I got the
So, I have an element on a webpage that is located under some other
I am looking for some good information on the best way for a design
I have a txt file which actually is a html source of some webpage.
I've got an app that under some circumstances causes IE8 to popup the compatibility
I've recently joined an asp.net mvc project well under way where there isnt much
This is my code to get a web page's image's URLs for some webpage,
How is it possible to allow a user to create a webpage containing some

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.