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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:40:10+00:00 2026-06-07T23:40:10+00:00

I am developing Online Quiz Module. So i have define 2 types of questions.

  • 0

I am developing Online Quiz Module.
So i have define 2 types of questions.

  1. Multiple Choice Single Option(Radio Button)
  2. Multiple Choice Multiple Option(Checkbox)
  3. Other Naswer(Textbox)

I have used Nested Repeater.The first repeater bind the Question.
And the child repeater bind the Options available for the Questions.

So what i want is i want to check the COndition,

Like if my QuestionType is MS(Multiple Choice Single Option) the i will bind the 4 options with Radio Buttons.

If its MM(Multiple Choice Multiple Option) then i will bind Options with Checkbox.

So how can i check such condition and code in the aspx file.?

  • 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-07T23:40:12+00:00Added an answer on June 7, 2026 at 11:40 pm

    This is a way to do it:

    Output

    enter image description here

    ASPX

        <asp:Repeater runat="server" ID="repeater" DataSourceID="ods" 
            onitemdatabound="repeater_ItemDataBound">
            <ItemTemplate>
                <asp:Label Text='<%# Eval("QuestionText") %>' runat="server" />
                <br />
                <asp:Panel runat="server" ID="panel">
                </asp:Panel>
            </ItemTemplate>
        </asp:Repeater>
        <asp:ObjectDataSource ID="ods" runat="server" 
            SelectMethod="GetQuestions" 
            TypeName="WebApplication1.Questions.QuestionsContext">
        </asp:ObjectDataSource>
    

    Code behind

        protected void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var q = e.Item.DataItem as Question;
    
            if (q == null)
                throw new InvalidOperationException();
    
            var panel = e.Item.FindControl("panel");
    
            if (q.MultipleAnswers)
            {
                var checks = new CheckBoxList { DataSource = q.Answers, DataTextField = "AnswerText", DataValueField = "ID" };
                checks.DataBind();
    
                panel.Controls.Add(checks);
            }
            else
            {
                var radios = new RadioButtonList { DataSource = q.Answers, DataTextField = "AnswerText", DataValueField = "ID" };
                radios.DataBind();
    
                panel.Controls.Add(radios);
            }
        }
    

    Data component

    This is just for testing, replace it with your data source

    public class QuestionsContext
    {
        public IEnumerable<Question> GetQuestions()
        {
            var q = Builder<Question>.CreateListOfSize(5).Build().ToList();
            q.ForEach(x =>
            {
                x.ID = Guid.NewGuid();
                x.Answers = Builder<Answer>.CreateListOfSize(4)
                    .All().With(y => y.Question, x)
                    .Build().ToList();
            });
    
            return q;
        }
    }
    

    Model

    public class Answer
    {
        public Guid ID { get; set; }
        public Question Question { get; set; }
        public string AnswerText { get; set; }
        public bool IsCorrect { get; set; }
    }
    public class Question
    {
        public Guid ID { get; set; }
        public string QuestionText { get; set; }
        public IEnumerable<Answer> Answers { get; set; }
        public bool MultipleAnswers { get; set; }
    
        public Question()
        {
            this.Answers = Enumerable.Empty<Answer>();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing online examination system in php-mysql. That exam will consist of multiple-choice questions;
I am Developing a online test(Multiple choice) in C# asp.net. I have to show
I'm developing an online website (using Django and Mysql). I have a Tests table
I'm developing an online tool that involves image editing. Pixlr is my first choice
I'm developing a LAMP online store, which will allow admins to upload multiple images
I have been developing a new online game for the past year now. The
I'm developing a web application which have a online forum with it. I'm going
I had asked some questions about developing an online judge sometime ago on stackoverflow
I am developing an online store for my customer and, we only have one
I'm developing an online gallery with voting and have a separate table for pictures

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.