2 Replies Latest reply on Feb 11, 2008 2:24 PM by ntsiii

    Running a script on button click

    BigGunN Level 1
      I am new to Flex so I apologize in advance if this a dumb question. I have a website previously built in ASP with an Access DB. I have figured out how to read from the DB by creating a Recordset and putting it into an array and then creating a XML formatted string, and then reading that into a datagrid. What I am trying to do is to make the datagrid editable and then be able to save the changes back to the DB. So I guess I really have 2 questions: 1. Where are the changes made to the datagrid being stored and what do I use to reference them, and 2. When I click a SAVE CHANGES button, how do I send that information to a script on the server?

      Thanks in advance
        • 1. Re: Running a script on button click
          Gregory Lafrance Level 6
          If you use a "model" and enable data binding, any changes you make in the datagrid can be immediately reflected in a construct in the Flex app on the client side. When the SAVE CHANGES button is clicked, you can have the local construct update your data model, which will update your data model, once again using data binding.

          See this FB 2.0.1 help topics:
          Defining a data model
          Storing Data
          • 2. Re: Running a script on button click
            ntsiii Level 3
            I use asp.net as my back-end and use xml strings to send data between my server and client tiers.

            If you are using httpservice to get your data into flex, and have set resultFormat="e4x"(othrwise flex converts your xml into a nested object structure, not good.), then changes make via the editable dataGrid are automatically saved in the dataProvider. So sending the data back might be as easy as:
            var oRequest:Object ={xml:myXMLDataProvider.toXMLString()}

            Serverside this data will be accessible as a requst arg.
            dim sXml as string = Request("xml") 'works for post or get