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. General Programming
  3. C#
  4. Drop down control.

Drop down control.

Scheduled Pinned Locked Moved C#
performancehelptutorial
11 Posts 5 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.
  • S Offline
    S Offline
    Sasmi_Office
    wrote on last edited by
    #1

    Hi Friend, This is normal but want to know how it's done. I have multiple drop down on one form which are related to each other. Country Drop down City Drop down Location Drop down If user select Country it will fill drop down and so on, but when user again select new country system should clear the related drop down it's working fine but because of that its taking time which is issue need to know how to speed this. thanks in advance. Sasmi

    0 D 2 Replies Last reply
    0
    • S Sasmi_Office

      Hi Friend, This is normal but want to know how it's done. I have multiple drop down on one form which are related to each other. Country Drop down City Drop down Location Drop down If user select Country it will fill drop down and so on, but when user again select new country system should clear the related drop down it's working fine but because of that its taking time which is issue need to know how to speed this. thanks in advance. Sasmi

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      Are you hitting database everytime country selection is changed? That will slow things down. Unless you show some code about how you are doing this, it would be tough to help.

      50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

      0 S N 3 Replies Last reply
      0
      • S Sasmi_Office

        Hi Friend, This is normal but want to know how it's done. I have multiple drop down on one form which are related to each other. Country Drop down City Drop down Location Drop down If user select Country it will fill drop down and so on, but when user again select new country system should clear the related drop down it's working fine but because of that its taking time which is issue need to know how to speed this. thanks in advance. Sasmi

        0 Offline
        0 Offline
        0x3c0
        wrote on last edited by
        #3

        Which code is populating the dropdown boxes? What part of the code is slow? If you're searching through a database, have you used the WHERE clause, or are you just iterating over the results when the list is populated?

        OSDev :)

        S 1 Reply Last reply
        0
        • D dan sh

          Are you hitting database everytime country selection is changed? That will slow things down. Unless you show some code about how you are doing this, it would be tough to help.

          50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

          0 Offline
          0 Offline
          0x3c0
          wrote on last edited by
          #4

          Just beat me to it :-D

          OSDev :)

          D 1 Reply Last reply
          0
          • 0 0x3c0

            Just beat me to it :-D

            OSDev :)

            D Offline
            D Offline
            dan sh
            wrote on last edited by
            #5

            This has happenned with me a few times earlier as well. Fortunately, I was lucky enough to come out as a winner every single time. :)

            50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

            1 Reply Last reply
            0
            • 0 0x3c0

              Which code is populating the dropdown boxes? What part of the code is slow? If you're searching through a database, have you used the WHERE clause, or are you just iterating over the results when the list is populated?

              OSDev :)

              S Offline
              S Offline
              Sasmi_Office
              wrote on last edited by
              #6

              thanks for your quick response me using following query to fill dropdown "select CountryName, CountryID from CountryTable" "select CityName, CityID from CityDetails where CountryID = 1" "select LocationName, LocationID from LocationDetails wherer CityID = 1" this way the data has been retrive from database but before that i want to clearify at page Load it initialize each control DropDown1.Items.Clear() ListItem _Item = new ListItem("-Select Country-",0) DropDown1.Items.Insert(_Item, 0) DropDown2.Items.Clear() ListItem _Item = new ListItem("-Select City-",0) DropDown2.Items.Insert(_Item, 0) DropDown3.Items.Clear() ListItem _Item = new ListItem("-Select Location-",0) DropDown3.Items.Insert(_Item, 0) when i change selection of Country drop down again DropDown2.Items.Clear() ListItem _Item = new ListItem("-Select City-",0) DropDown2.Items.Insert(_Item, 0) DropDown3.Items.Clear() ListItem _Item = new ListItem("-Select Location-",0) DropDown3.Items.Insert(_Item, 0) this way its coded.. hope you get what i coded on my form sasmi

              1 Reply Last reply
              0
              • D dan sh

                Are you hitting database everytime country selection is changed? That will slow things down. Unless you show some code about how you are doing this, it would be tough to help.

                50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

                S Offline
                S Offline
                Sasmi_Office
                wrote on last edited by
                #7

                thanks for your quick response me using following query to fill dropdown "select CountryName, CountryID from CountryTable" "select CityName, CityID from CityDetails where CountryID = 1" "select LocationName, LocationID from LocationDetails wherer CityID = 1" this way the data has been retrive from database but before that i want to clearify at page Load it initialize each control DropDown1.Items.Clear() ListItem _Item = new ListItem("-Select Country-",0) DropDown1.Items.Insert(_Item, 0) DropDown2.Items.Clear() ListItem _Item = new ListItem("-Select City-",0) DropDown2.Items.Insert(_Item, 0) DropDown3.Items.Clear() ListItem _Item = new ListItem("-Select Location-",0) DropDown3.Items.Insert(_Item, 0) when i change selection of Country drop down again DropDown2.Items.Clear() ListItem _Item = new ListItem("-Select City-",0) DropDown2.Items.Insert(_Item, 0) DropDown3.Items.Clear() ListItem _Item = new ListItem("-Select Location-",0) DropDown3.Items.Insert(_Item, 0) this way its coded.. sasmi

                L D 2 Replies Last reply
                0
                • S Sasmi_Office

                  thanks for your quick response me using following query to fill dropdown "select CountryName, CountryID from CountryTable" "select CityName, CityID from CityDetails where CountryID = 1" "select LocationName, LocationID from LocationDetails wherer CityID = 1" this way the data has been retrive from database but before that i want to clearify at page Load it initialize each control DropDown1.Items.Clear() ListItem _Item = new ListItem("-Select Country-",0) DropDown1.Items.Insert(_Item, 0) DropDown2.Items.Clear() ListItem _Item = new ListItem("-Select City-",0) DropDown2.Items.Insert(_Item, 0) DropDown3.Items.Clear() ListItem _Item = new ListItem("-Select Location-",0) DropDown3.Items.Insert(_Item, 0) when i change selection of Country drop down again DropDown2.Items.Clear() ListItem _Item = new ListItem("-Select City-",0) DropDown2.Items.Insert(_Item, 0) DropDown3.Items.Clear() ListItem _Item = new ListItem("-Select Location-",0) DropDown3.Items.Insert(_Item, 0) this way its coded.. sasmi

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  It seems you are hitting the database everytime a country or city is changed, that's why it is so slow. Load your lists in a JavaScript array and rewrite your logic using JavaScript.

                  1 Reply Last reply
                  0
                  • D dan sh

                    Are you hitting database everytime country selection is changed? That will slow things down. Unless you show some code about how you are doing this, it would be tough to help.

                    50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

                    N Offline
                    N Offline
                    Nguyen Thanh Quyen
                    wrote on last edited by
                    #9

                    Check valid field when pass to Controls

                    Công ty Đất Quảng - Cong ty Dat Quang - http://datquangda.com.vn Bất động sản, mua bán nhà đất khu đô thị mới Nam An Khánh Hà Nội. Trụ sở: Phòng 303 nhà N6E – Trung Hoà Nhân Chính – Thanh Xuân – Hà Nội - Vietnam Văn phòng giao dịch: Số nhà 10, ngách 23, ngõ 61, Trần Duy Hưng, Trung Hòa, Cầu Giấy, Hà Nội, Vietnam Điện thoai: 04.3556 2516 - 3556 2552 - 2247 5733 Fax: 04.3556 2566 - 3556 2140 Email:datquangda@gmail.com Website: http://www.datquangda.com.vn

                    D 1 Reply Last reply
                    0
                    • N Nguyen Thanh Quyen

                      Check valid field when pass to Controls

                      Công ty Đất Quảng - Cong ty Dat Quang - http://datquangda.com.vn Bất động sản, mua bán nhà đất khu đô thị mới Nam An Khánh Hà Nội. Trụ sở: Phòng 303 nhà N6E – Trung Hoà Nhân Chính – Thanh Xuân – Hà Nội - Vietnam Văn phòng giao dịch: Số nhà 10, ngách 23, ngõ 61, Trần Duy Hưng, Trung Hòa, Cầu Giấy, Hà Nội, Vietnam Điện thoai: 04.3556 2516 - 3556 2552 - 2247 5733 Fax: 04.3556 2566 - 3556 2140 Email:datquangda@gmail.com Website: http://www.datquangda.com.vn

                      D Offline
                      D Offline
                      dan sh
                      wrote on last edited by
                      #10

                      :confused:

                      50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

                      1 Reply Last reply
                      0
                      • S Sasmi_Office

                        thanks for your quick response me using following query to fill dropdown "select CountryName, CountryID from CountryTable" "select CityName, CityID from CityDetails where CountryID = 1" "select LocationName, LocationID from LocationDetails wherer CityID = 1" this way the data has been retrive from database but before that i want to clearify at page Load it initialize each control DropDown1.Items.Clear() ListItem _Item = new ListItem("-Select Country-",0) DropDown1.Items.Insert(_Item, 0) DropDown2.Items.Clear() ListItem _Item = new ListItem("-Select City-",0) DropDown2.Items.Insert(_Item, 0) DropDown3.Items.Clear() ListItem _Item = new ListItem("-Select Location-",0) DropDown3.Items.Insert(_Item, 0) when i change selection of Country drop down again DropDown2.Items.Clear() ListItem _Item = new ListItem("-Select City-",0) DropDown2.Items.Insert(_Item, 0) DropDown3.Items.Clear() ListItem _Item = new ListItem("-Select Location-",0) DropDown3.Items.Insert(_Item, 0) this way its coded.. sasmi

                        D Offline
                        D Offline
                        dan sh
                        wrote on last edited by
                        #11

                        You seem to hitting database all the time. Get the list in one go and cache it. Then, all you need is to filter the datasource for second and third dropdowns. BTW give your controls a descriptive name.

                        50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

                        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