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. Plz help me to display data on Dropdownlist

Plz help me to display data on Dropdownlist

Scheduled Pinned Locked Moved ASP.NET
helpdatabase
8 Posts 4 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.
  • P Offline
    P Offline
    P_Elza
    wrote on last edited by
    #1

    Hi all I have a problem. Am tring to display data on dropdown list, i have two dropdown list. i'm displaying data on both from database. when the application starts running the first ddl will list out some data. when we select one the second ddl will display data according to that. but here the problem is, when i select one on first ddl, it is automaticaly errasing all the datas..... i havint given any where clear command. y it ts not displaying. the problem i nly when it is connected to database. i tried a sample, it is working. plz help me....

    C S N 3 Replies Last reply
    0
    • P P_Elza

      Hi all I have a problem. Am tring to display data on dropdown list, i have two dropdown list. i'm displaying data on both from database. when the application starts running the first ddl will list out some data. when we select one the second ddl will display data according to that. but here the problem is, when i select one on first ddl, it is automaticaly errasing all the datas..... i havint given any where clear command. y it ts not displaying. the problem i nly when it is connected to database. i tried a sample, it is working. plz help me....

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      P_Elza wrote:

      i tried a sample, it is working.

      Not sure what this means. Have you set breakpoints to see what code is executed ? Best guess is that you're setting the data source on postback, which will clear all viewstate. But that doesn't seem to be exactly what you're describing, do you have a code sample ?

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it )

      P 1 Reply Last reply
      0
      • P P_Elza

        Hi all I have a problem. Am tring to display data on dropdown list, i have two dropdown list. i'm displaying data on both from database. when the application starts running the first ddl will list out some data. when we select one the second ddl will display data according to that. but here the problem is, when i select one on first ddl, it is automaticaly errasing all the datas..... i havint given any where clear command. y it ts not displaying. the problem i nly when it is connected to database. i tried a sample, it is working. plz help me....

        S Offline
        S Offline
        Sandeep Akhare
        wrote on last edited by
        #3

        Try to debug the application put a break point and see whats happening ? i think after post back the drop down list is not getting populated

        Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

        1 Reply Last reply
        0
        • P P_Elza

          Hi all I have a problem. Am tring to display data on dropdown list, i have two dropdown list. i'm displaying data on both from database. when the application starts running the first ddl will list out some data. when we select one the second ddl will display data according to that. but here the problem is, when i select one on first ddl, it is automaticaly errasing all the datas..... i havint given any where clear command. y it ts not displaying. the problem i nly when it is connected to database. i tried a sample, it is working. plz help me....

          N Offline
          N Offline
          Nuri YILMAZ 0
          wrote on last edited by
          #4

          Do you check IsPostBack when you load data collection for ddl? :wtf: You should remember; page_load method works before every event-delegation method (ddl SelectedIndexChanged too).:doh:

          we can work IT out! (Beatles)

          1 Reply Last reply
          0
          • C Christian Graus

            P_Elza wrote:

            i tried a sample, it is working.

            Not sure what this means. Have you set breakpoints to see what code is executed ? Best guess is that you're setting the data source on postback, which will clear all viewstate. But that doesn't seem to be exactly what you're describing, do you have a code sample ?

            Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it )

            P Offline
            P Offline
            P_Elza
            wrote on last edited by
            #5

            ya i have set but its not entering to private void DdlCustomer_SelectedIndexChanged(object sender, System.EventArgs e)even if i change the selection. Code Sample private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { Production.Add_CustomerToCombo(DdlCustomer,DdlTitle,dgDetailData,SQL_SELECT_CUST_NAME);//CALLING OF THE FUNCTION TO FILL CUSTOMER COMBOBOX } logintime.Text=System.DateTime.Now.ToLongDateString(); BtnSave.Visible=false; } private void DdlCustomer_SelectedIndexChanged(object sender, System.EventArgs e) { BtnSave.Visible=true; DdlTitle.Items.Clear(); DdlTitle.Items.Add(new ListItem("---SELECT---","0")); }

            C 1 Reply Last reply
            0
            • P P_Elza

              ya i have set but its not entering to private void DdlCustomer_SelectedIndexChanged(object sender, System.EventArgs e)even if i change the selection. Code Sample private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { Production.Add_CustomerToCombo(DdlCustomer,DdlTitle,dgDetailData,SQL_SELECT_CUST_NAME);//CALLING OF THE FUNCTION TO FILL CUSTOMER COMBOBOX } logintime.Text=System.DateTime.Now.ToLongDateString(); BtnSave.Visible=false; } private void DdlCustomer_SelectedIndexChanged(object sender, System.EventArgs e) { BtnSave.Visible=true; DdlTitle.Items.Clear(); DdlTitle.Items.Add(new ListItem("---SELECT---","0")); }

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              OK, then the combobox isn't set up to handle the event, or it's autopostback is not set to true. And, I still think your viewstate is probably off.

              Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it )

              P 1 Reply Last reply
              0
              • C Christian Graus

                OK, then the combobox isn't set up to handle the event, or it's autopostback is not set to true. And, I still think your viewstate is probably off.

                Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it )

                P Offline
                P Offline
                P_Elza
                wrote on last edited by
                #7

                autopostback is set to true and viewstate is on. but i didnt get

                Christian Graus wrote:

                combobox isn't set up to handle the event

                S 1 Reply Last reply
                0
                • P P_Elza

                  autopostback is set to true and viewstate is on. but i didnt get

                  Christian Graus wrote:

                  combobox isn't set up to handle the event

                  S Offline
                  S Offline
                  Sandeep Akhare
                  wrote on last edited by
                  #8

                  Do one thing override the page init method put the code of populating the drop down in that method so it will populate every time regardless of postback if you don't want to hit the database every time then put all values in session instead and and get vlaues from session or similar to like that

                  Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

                  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