Using AxContentPanel Control in EP


AXContentPanel is derived from ASP.net UpdatePanel and enalbes sections of the web page refreshed instead of the entire page  being refreshed with a postback and makes it more in. AxContentPanel builds on top of this and provides AX Specific constructs such as Passing Record Context and applying it to the underlying child controls.


 


If you have a child user control that needs to display based on the context provided by the datasource in the parent user control or two independent datasources that do not have direct table level relation but one needs to change based on the context from the first datasource after executing some business logic, then AxContentPanel would come in handy.


 


For example , if I have a page with Header and Detail  Datasources separately and need to apply the context of the newly created header record in the top part of the page to the detail part of the page, then I would something like


 


For example


<dynamics:AxDataSource ID=”DemoExpenseHeaderDS” runat=”server”


    DataSetName=”DemoExpenseHeader” ProviderView=”DemoExpenseTable”>


</dynamics:AxDataSource>




Header part of markup




<dynamics:AxSection ID=”AxSection4″ runat=”server” Caption=”Expense Lines”


        Font-Bold=”True” Font-Size=”Large” ForeColor=”#336600″>


        <dynamics:AxContentPanel ID=”AxContentPanel_ExpenseLine” runat=”server”>


<ContentTemplate>


<dynamics:AxDataSource ID=”DemoExpenseLineDS” runat=”server”


    DataSetName=”DemoExpenseLine” Role=”Consumer”>


</dynamics:AxDataSource>


<dynamics:AxGridView ID=”DemoExpenseLineGrid” runat=”server” AllowDelete=”True”


            AllowEdit=”True” DataKeyNames=”RecId”


            DataMember=”demoexpenseline” DataSourceID=”DemoExpenseLineDS”


            ShowFilter=”False”>


                <Columns>


                    <dynamics:AxDropDownBoundField DataField=”ExpenseCategory”


                        DataSet=”DemoExpense” DataSetView=”demoexpenseline”


                        SortExpression=”ExpenseCategory”>


                    </dynamics:AxDropDownBoundField>




                </Columns>


        </dynamics:AxGridView>


</ContentTemplate>


        </dynamics:AxContentPanel>


 


 


    protected void Page_Init(object sender, EventArgs e)


    {


        IAxContext contextInterface = AxContextHelper.FindIAxContext(this);


        if (contextInterface != null)


             contextInterface.CurrentContextChanged += new EventHandler<AxCurrentContextChangedEventArgs>(CurrentContextChanged);


       


    }


    protected void CurrentContextChanged(object sender, AxCurrentContextChangedEventArgs e)


    {


        if (e.CurrentContext != null)


        {


            this.AxContentPanel_ExpenseLine.ExternalContext = e.CurrentContext.RootTableContext;


      


        }


    }

Comments (1)

  1. mrhassell says:

    One problem Mey, this seems to mess with the context query string – I found this approach good until I needed to pass from one web part to another using context and a navigation web part as the conduit, then the query string was not being modified in the browser and hence the context was never received at the directed web part.