5 Replies Latest reply on Apr 20, 2006 8:31 AM by ntsiii

    want to fill combobox in diff. row from database

    parthgladiator Level 1
      hello

      Everyone:

      I have retrieve data from Sql server by ASP and flex ,and i want to fill combobox ,but i am getting all that in one row in combo box;so give me any suggestion that i can fill combo through in different row.

      Regards
      Parth
        • 1. Re: want to fill combobox in diff. row from database
          ntsiii Level 3
          Are you binding the dataProvider to the result directly, or using a result handler function?

          What does the structure of the data look like?

          Have you set the HTTPService resultFormat to anything?

          Tracy
          • 2. Re: want to fill combobox in diff. row from database
            parthgladiator Level 1
            my resultFormat is text/XML

            i have three value in databse

            AAA
            BBB
            CCC

            i am getting all three value in one row in combobox like AAA BBB CCC

            becaz i m getting all the value in just one string'

            so how can i do it?

            reagards
            Parth
            • 3. Re: want to fill combobox in diff. row from database
              ntsiii Level 3
              No, your resultFormat is not "text/XML", that is your ASP page's response ContentType.

              "resultFormat" is a property on the HTTPService tag. If you have not set it yourself. then it is "object".

              I don't need to know what the data in the database is, I need to know what the structure of the result object is. What is the structure of the xml that is output by the asp page?

              How are you debugging your code, Flex builder, tracing or alert boxes?

              Are you using a result handler function to assign the result to the combobox dataProvider or are you using binding?

              Post the code.

              Tracy
              • 4. Re: want to fill combobox in diff. row from database
                parthgladiator Level 1

                here i am sending the codeof both asp page and mxml page:

                ihope now the picure becomes clear;
                • 5. Re: want to fill combobox in diff. row from database
                  ntsiii Level 3
                  Combobox and the other list based controls require an Array as the dataProvider, where each element in the array creates an item or row. When you do this:
                  var sData:String = xmlnodeTest.toString();
                  myDP=new Array();
                  myDP.addItem(sData);

                  You are creating an array with a single element that contains all the text of the xml. this is why you get only one row with all the data.

                  Since the resultFormat is XML, you can get the item array using the childNodes property of the root node. So Instead you want something like:
                  var myDP:Array = xmlnodeTest.childNodes;

                  Combobox will default to looking for "label" and "data" properties. If your item xml nodes do not have these exact attributes, you will need to use a labelFunction to put the correct data into the Combo box. What is the structure of the xml that is output by the asp page? Call it directly from a browser, and post a few nodes.

                  Tracy