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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:46:20+00:00 2026-05-12T06:46:20+00:00

i am self-studying asp.net and was trying some small projects to help understand the

  • 0

i am self-studying asp.net and was trying some small projects to help understand the concepts better.

i am creating a simple e-learning website using html and asp.net(c#), that has a fixed number of multiple choices questionnaire on one of its pages,
i create the questionnaire by choosing random questions, out of a database table ,then creating a string that will hold the html code containing the questions properly formatted (questions in labels and answers as radio buttons),before inserting it into the innerhtml of a div tag.
all the above being done on pageload();
the problem is that i need to check the answers against the answer sheet (i already stored the correct answers in an array),but since the html code get added after page load, the code behind cant see the tags or their ids.

The question:
i’ve been told i can access the html tags using request.form[“Q#”] ?
can some1 please explain to me..how it can be done ?

and any other possible ways to do the same task ? (read the note below plz)

Note:
i know i can create the questionnaire structure in html, and then add the questions/answers into labels.

or creating hidden fields with runat server properties and then storing the answers into them, and checking the answer sheet against them with server side code.

  • 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-05-12T06:46:20+00:00Added an answer on May 12, 2026 at 6:46 am

    The question: i’ve been told i can access the html tags using request.form[“Q#”] ? can some1 please explain to me..how it can be done ?

    It’s pretty much exactly what you’ve written. Request.Form is an associative array with one record for each form field on your page. The array is keyed by the name attribute of the input field. For server side controls this usually defaults to the control’s ClientId… But if you’re generating the HTML yourself, anything goes.

    if(Request.Form["Q0"] == answers[0]) {
        //Answer is correct
    }
    

    However, from the sound of things there are better ways to accomplish what you’re after.

    One option would be to use a Repeater control, and to set its datasource to an array containing the information about the questions. You can then do something like this:

    foreach(item as RepeaterItem in repeater) {
        if(item.FindControl("radioButtonListId").SelectedValue == answer) {
            //Answer correct
        }
    }
    

    Edit:

    Here’s a quick explanation of how the Request.Form collection is populated.

    A typical request for a page works like this:
    The client sends a request to the page to the server.
    The server executes the Asp.Net page life cycle (init, load, control events, render).
    The server takes the HTML generated by Asp.Net and sends it to the client.

    When the client want’s to send more information back to the server, it does so by submitting a special form generated by Asp.Net. This results in the value of each input control being attached to the request sent to Asp.Net:

    The client sends a POST request to the server (with form values attached).
    The server executes the Asp.Net page life cycle (init, load, control events, render).
    The server takes the HTML generated by Asp.Net and sends it to the client.

    As you can see, if Request.Form is going to have a value, it is set before PageInit begins (much less PageLoad).

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

Sidebar

Related Questions

I am self studying computer architecture offer at Michigan university. I do not understand
I'm stuck with this. I'm self studying assenbler and translating some basics instructions. But
Question is pretty self explanitory. I want to do a simple find and replace,
I am self-studying a C# reference and it gives the following information: 1.21.4. Declaring
I'm currently self-studying C# in my free time and thought of a little project
I'm currently self-studying C for mastering an university project. In that project we have
self.logger.info(msg) popinstance=poplib.POP3(self.account[0]) self.logger.info(popinstance.getwelcome()) popinstance.user(self.account[1]) popinstance.pass_(self.account[2]) try: (numMsgs, totalSize)=popinstance.stat() self.logger.info(POP contains + str(numMsgs) + emails)
Pretty self-explanatory, I tried google and got a lot of the dreaded expertsexchange, I
Pretty self explanatory question. Is there any reason to use one or the other?
Assuming self-registration is used to install components as part of a larger installer program,

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.