Programatically reading data from AxDataSourceControl


DataSourceControl makes it simple to get Ax data and display it in DataBound UI controls and manipulate the data. You can also use them to read data programtically. Below is one way of doing it. The other way to get Ax data programatically is to get the DataSet directly using MetaDataCahce object and reading data.


 


private void GetData()


      {


 


            DataSourceViewSelectCallback callback = new DataSourceViewSelectCallback(PrintData);


              AxDataSource1.GetDataSourceView(“CustTable”).Select(DataSourceSelectArguments.Empty,callback);


   


      }


 


    private void PrintData(IEnumerable data)


    {


        IEnumerator i = data.GetEnumerator();


        while (i.MoveNext())


        {


            Response.Write(DataBinder.Eval(i.Current, “AccountNum”).ToString() + “<BR/>”);


        }


    }

Comments (2)

  1. Dear Mey,

    Is it a good idea to use genuine ASP.NET controls or third-party .NET controls as opposed to the AX WebUI controls (AX2009) in case the EP AX controls do not offer sufficient functionality? What about next versions of Dynamics AX, will they still support objects like AxaptaRecord?

    guido de jong

Skip to main content