Question

Lets say that I want to show records from a table into an AxGridView and make that AxGrivView being able to create, edit and delete a record, are there any good tutorial on how to accomplish that?

EDIT

I'll try and explain what I've done so: I've this dataset:

with these properties for eg. TrvExpParm_cars:

My user control contains this code:

<dynamics:AxColumn ID="TopRowRight" runat="server">
        <dynamics:AxMultiSection ID="AxMultiSection1" runat="server">
            <dynamics:AxSection ID="AxSection1" runat="server" Caption="Mine biler" Expanded="true">
                <dynamics:AxDataSource ID="dsEPTrvExpParm_cars" runat="server" DataSetName="EPTrvExpParm" ProviderView="TrvExpParm"> </dynamics:AxDataSource>

                <dynamics:AxGridView ID="AxGridView_cars" runat="server" 
                    AllowDelete="True" AllowEdit="True" AllowPaging="False" BodyHeight="" 
                    DataKeyNames="RecId" DataMember="TrvExpParm_cars" 
                    DataSetCachingKey="xxxxxxxxxxxxxxxxxxx" 
                    DataSourceID="dsEPTrvExpParm_cars" EnableModelValidation="True">
                    <Columns>
                        <dynamics:AxBoundField DataField="Name" DataSet="EPTrvExpParm" 
                            DataSetView="TrvExpParm_cars" SortExpression="Name">
                        </dynamics:AxBoundField>
                        <dynamics:AxBoundField DataField="LicensePlate" DataSet="EPTrvExpParm" 
                            DataSetView="TrvExpParm_cars" SortExpression="LicensePlate">
                        </dynamics:AxBoundField>
                    </Columns>
                </dynamics:AxGridView>

            </dynamics:AxSection>
        </dynamics:AxMultiSection>
    </dynamics:AxColumn>

What I get is an empty grid:

enter image description here

The table EPTrvExpParm_cars contains two fields with 2 records:

enter image description here

I really don't know why I can't see the data from the table. Are there some properties that I need to set or do I need som custom code? According to the Dynamics AX 2012 Enterprise Portal Cookbook, custom code shouldn't be needed, but again it's just a "cookbook"

UPDATE The relation between TrvExpParm and TrvExpParm_cars is this:

enter image description here

Was it helpful?

Solution

What is the relation between your TrvExpParm and TrvExpParm_cars?

The way your datasource is defined the TrvExpParm is the data provider (providerview) so it will look for a TrvExpParm record (the first) and will try to show the linked TrvExpParm_cars records because in your gridview you choose TrvExpParm_cars as DataSetView.

OTHER TIPS

The following whitepaper should help you do that: Microsoft Dynamics AX 2012 White Paper: Enterprise Portal Development Cookbook

A quote from the document:

AxGridView also includes built-in data modification capabilities. By using AxGridView with the declarative AxDataSource, you can easily configure and modify data without writing code. [...] AllowInsert, AllowEdit, and AllowDelete properties control the create, read, update, and delete operations on the grid.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top