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. General Approach to DropDownLists

General Approach to DropDownLists

Scheduled Pinned Locked Moved ASP.NET
databasequestionhelplounge
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.
  • B Offline
    B Offline
    BugMeNotFTW
    wrote on last edited by
    #1

    Hi, I've just done a basic "survey" web page which lists a number of questions for users to fill in and submit - each survey is then saved to a SQL database in the "Survey" table. At the moment, the questions are multiple choice, so the answers are yes/no, or strings of text. One of the question's answers is some 30 characters long and virtually all the answers can be chosen from DropDownList controls. It all works fine as it it is but as you can imagine, while I can store the strings of text in each record it seems that a more efficient way would be to store the index of the choice from the DropDownList so I'd be able to use INTs instead of NTEXT. My problem is this: should I implement a table for each question on the database consisting of a string and int value and bind the web controls on page load; or should I have some sort of enum type for each question with a DropDownList. If the latter, how can I associate a string of text with an int? I can't create a set of enums containing text can I? Thanks for any help :)

    D S 2 Replies Last reply
    0
    • B BugMeNotFTW

      Hi, I've just done a basic "survey" web page which lists a number of questions for users to fill in and submit - each survey is then saved to a SQL database in the "Survey" table. At the moment, the questions are multiple choice, so the answers are yes/no, or strings of text. One of the question's answers is some 30 characters long and virtually all the answers can be chosen from DropDownList controls. It all works fine as it it is but as you can imagine, while I can store the strings of text in each record it seems that a more efficient way would be to store the index of the choice from the DropDownList so I'd be able to use INTs instead of NTEXT. My problem is this: should I implement a table for each question on the database consisting of a string and int value and bind the web controls on page load; or should I have some sort of enum type for each question with a DropDownList. If the latter, how can I associate a string of text with an int? I can't create a set of enums containing text can I? Thanks for any help :)

      D Offline
      D Offline
      David Mujica
      wrote on last edited by
      #2

      Consider a general table called, "Survey", in this table you could store an XML file which would have both your questions and your values of drop down boxes. You could then create another table called "SurveyResults" which would store the results of your survey in an XML file. By using a design like this, you could have vastly different surverys and not have to change your storage structure. Something to think about.

      1 Reply Last reply
      0
      • B BugMeNotFTW

        Hi, I've just done a basic "survey" web page which lists a number of questions for users to fill in and submit - each survey is then saved to a SQL database in the "Survey" table. At the moment, the questions are multiple choice, so the answers are yes/no, or strings of text. One of the question's answers is some 30 characters long and virtually all the answers can be chosen from DropDownList controls. It all works fine as it it is but as you can imagine, while I can store the strings of text in each record it seems that a more efficient way would be to store the index of the choice from the DropDownList so I'd be able to use INTs instead of NTEXT. My problem is this: should I implement a table for each question on the database consisting of a string and int value and bind the web controls on page load; or should I have some sort of enum type for each question with a DropDownList. If the latter, how can I associate a string of text with an int? I can't create a set of enums containing text can I? Thanks for any help :)

        S Offline
        S Offline
        shreekar
        wrote on last edited by
        #3

        I think you need to work on the database design first before you tackle the front end. Like you said - create a table with list of questions. Create another table with list of possible answers per question. This will give you Id(s) to work with for question and answer. About the dropdowns,you have to display the data in the dropdowns, so that needs to be transported to the browser. While writing back to the server, you can use the selected id(s) of the answers. This way you can use bound controls as well. Hope this helps. Shreekar

        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