Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ow can i use labels with arrays as label(i).text ...

ow can i use labels with arrays as label(i).text ...

Scheduled Pinned Locked Moved ASP.NET
questiondatabasevisual-studio
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TechnoGrey
    wrote on last edited by
    #1

    I want to explain something about what i want to do. I am making a test-quiz projects for students.There is a lot of questions and choices in the database.I want to relate with questions to labels and choices to radiobuttonlists items. label1.text =question1 radiobuttonlist1.item(0).text=choice1 radiobuttonlist1.item(1).text=choice2 radiobuttonlist1.item(2).text=choice3 radiobuttonlist1.item(3).text=choice4 label2.text=question2 radiobuttonlist2.item(0).text=choice5 radiobuttonlist2.item(1).text=choice6 radiobuttonlist2.item(2).text=choice7 radiobuttonlist2.item(3).text=choice8 . . . I want to do this in a loop and i have to use (i think) label(i).text, radiobuttonlist(i).items(0).text vs. How can i do this?

    G M 2 Replies Last reply
    0
    • T TechnoGrey

      I want to explain something about what i want to do. I am making a test-quiz projects for students.There is a lot of questions and choices in the database.I want to relate with questions to labels and choices to radiobuttonlists items. label1.text =question1 radiobuttonlist1.item(0).text=choice1 radiobuttonlist1.item(1).text=choice2 radiobuttonlist1.item(2).text=choice3 radiobuttonlist1.item(3).text=choice4 label2.text=question2 radiobuttonlist2.item(0).text=choice5 radiobuttonlist2.item(1).text=choice6 radiobuttonlist2.item(2).text=choice7 radiobuttonlist2.item(3).text=choice8 . . . I want to do this in a loop and i have to use (i think) label(i).text, radiobuttonlist(i).items(0).text vs. How can i do this?

      G Offline
      G Offline
      goyal manish
      wrote on last edited by
      #2

      you can do it by generating labels and radio buttons dynamically means generate them by writting the code on yours aspx.cs file. for eg. for(i)//loop for labels { label[i];//declare label for(j)// loop for radio buttons of choices { radiobuttons[j]; // declare radion button } }

      1 Reply Last reply
      0
      • T TechnoGrey

        I want to explain something about what i want to do. I am making a test-quiz projects for students.There is a lot of questions and choices in the database.I want to relate with questions to labels and choices to radiobuttonlists items. label1.text =question1 radiobuttonlist1.item(0).text=choice1 radiobuttonlist1.item(1).text=choice2 radiobuttonlist1.item(2).text=choice3 radiobuttonlist1.item(3).text=choice4 label2.text=question2 radiobuttonlist2.item(0).text=choice5 radiobuttonlist2.item(1).text=choice6 radiobuttonlist2.item(2).text=choice7 radiobuttonlist2.item(3).text=choice8 . . . I want to do this in a loop and i have to use (i think) label(i).text, radiobuttonlist(i).items(0).text vs. How can i do this?

        M Offline
        M Offline
        minhpc_bk
        wrote on last edited by
        #3

        Hi there, Because you want to loop through groups of a label and radiobuttonlist controls, so you may consider using a data-bound control like DataList or Repeater, and bind datasource ( questions and choices) from Db to the control. You can read more about the controls in MSDN.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups