Insert Data using Dropdowns

Discussion in 'C#' started by timhersh, Feb 26, 2012.

  1. #1
    Hello,
    I am a newbie at ASP and I am using Microsoft Visual Web Developer 2010 to create my site, C+.
    I have my database setup and everything is working great. I am using a DataView to allow the user to view the records in the database and they can also add them through that, this part I understand and it works great.
    My client would like to have a page where two things happen that I am not sure of:
    1) They want a page that only allows the user to ADD records to the database. I know how to allow them to add records but it is using the Dataview and I'm not sure how to turn off the other options "Edit".
    2) They want the user to have a predifined set of choices for some of the fields. For example one of the fields is "Color". We only want to be able to use "Blue, Green, Yellow or Red" as input fields. So I need a dropdown option but the trick is this dropdown option is populated by another field in the database (different table though). That table has the color options available and they might need to add or delete them in future.
    I'm sure this is fairly simple but I am used to using PHP and not sure how make this work in ASP. Any help would be appreciated.
     
    timhersh, Feb 26, 2012 IP
  2. shiful

    shiful Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It is better to use gridview then dataview. in grid view u select the smat tag where you will can see the menu. select edit column and modify the edit column section. that mens u can pick out the edit option.The 2nd solution is if ur dropdown option is populated by another field then u have to check out again the fields of database table. if there is any relation then u have to think which table should insert data first.
     
    shiful, Feb 26, 2012 IP
  3. timhersh

    timhersh Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you.
    Ok I am using gridview now.
    I clicked on the option to edit the fields--then I select the 'Update-Edit-Canel' field. It displays a list of CommandField properites on the right.
    I'm not sure which property I am looking for and what to do to make it so that only the field "arm" displays the dropdown options available.....the options I am wanting to display are in a different table called "options" which the field called "arm".
    any help would be great, thanks.
     
    timhersh, Feb 26, 2012 IP