locked
How to do drop down box in visual studio 2010? RRS feed

  • Question

  • User-67874579 posted
    Hi all
    Im beginner and i want to create a web form page for example page to enter employee details like full name ,age, country ... Etc
    And i want to have separate table for country field , and the country field shows on page as drop down box to show the saved country inside the country table ... Also the important thing i want to be able to edit and add country to the drop down list box..
    Could some one show me how to do it with screenshots
    Also how to make relations between the tabels
    Much appreciated
    Regards

    Thursday, January 30, 2014 2:54 PM

Answers

  • User-67874579 posted

    strange no boday answered me :( 

    but at least i figured out how to do it as googled it and found the solution and would like to share it with you .

    for drop down list you have to create a stored procedure to get the all items in the list.

    after that you have to have a DataAccess , then you will

     public DataTable GetAllSex()
        {
    
            SqlDataAdapter sda = new SqlDataAdapter("GetAllSex", conn);
            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            DataTable dt = new DataTable();
            sda.Fill(dt);
            return dt;
    

    after with you have to get this data adapter from your page ...

    thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 3, 2014 4:26 PM

All replies

  • User-67874579 posted

    strange no boday answered me :( 

    but at least i figured out how to do it as googled it and found the solution and would like to share it with you .

    for drop down list you have to create a stored procedure to get the all items in the list.

    after that you have to have a DataAccess , then you will

     public DataTable GetAllSex()
        {
    
            SqlDataAdapter sda = new SqlDataAdapter("GetAllSex", conn);
            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            DataTable dt = new DataTable();
            sda.Fill(dt);
            return dt;
    

    after with you have to get this data adapter from your page ...

    thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 3, 2014 4:26 PM
  • User-166373564 posted

    Hi siamand


    but at least i figured out how to do it as googled it and found the solution and would like to share it with you .

    Glad that you have solved this issue by yourself, and thanks for shring your solution and experience here, I think it will be helpful for other community members who have similar issue.

    If you have anything urgent, please feedback by creating another thread.

    Best regards

    Angie Xu

    Tuesday, February 4, 2014 10:49 PM