How to handle AxForm and AxGridView in a UserControl

Hi,

We are developing custom user controls for Detail Pages. We have Requirements of page have AxForm(AxGroup) and AXGridView (Header-Line). When i click the ‘save and close’ or ‘close’ button, it throws error always.Some time record is inserted in table . I dont have enough knowledge in C#.net code. Please suggest me what are the events has to be provided to solve this issue with sample codes or template codes. Thanks in Advance.

Hi Mohamed, welcome to Dynamics User Group forum.

Please write down more information about the error, especially its type, the error message and the call stack. It will greatly improve the chance that somebody will be able to help you.

I see that you provided the information in your duplicate thread on another forum, so it seems that we shouldn’t discuss the same thing in parallel here.

Hi Martin,

Now i am getting this error(Event Viewer). Do u have any sample codes or template codes to handle the AxForm(AxGroup) and AXGridView (Header-Line) in a user control? i am getting other errors also in some controls having both AxForm and AxGridView. I Got some idea from the link.

Error:

Dynamics Object Adapter Call failed.

RegisterRequiresControlState can only be called before and during PreRender.

System.InvalidOperationException

at System.Web.UI.Page.RegisterRequiresControlState(Control control)

at System.Web.UI.Control.AddedControl(Control control, Int32 index)

at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxBaseGridView.AddedControl(Control control, Int32 index)

at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxBaseGridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding)

at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)

at System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data)

at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxBaseGridView.PerformDataBinding(IEnumerable data)

at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)

at System.Web.UI.WebControls.DataBoundControl.PerformSelect()

at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxBaseGridView.PerformSelect()

at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()

at System.ComponentModel.ListChangedEventHandler.Invoke(Object sender, ListChangedEventArgs e)

at Microsoft.Dynamics.AX.ManagedInterop.ClrBridgeImpl.ExecuteHandler(ClrBridgeImpl* , ObjectWrapper* pObjectWrapperHandler, ObjectWrapper* pObjectWrapperSender, ObjectWrapper* pObjectWrapperEventArgs)

at AxEventDelegate.kcInvoke(AxEventDelegate* , interpret* ip)

at cqlClass.callEx(cqlClass* , Char* , interpret* )

at AxCore.AxRuntime.Call(AxRuntime* , IAxObject* axObject, String methodName, Type returnType, Object& result, Object[] paramList)

at Microsoft.Dynamics.AX.ManagedInterop.Object.CallWithReturnType(String methodName, Type returnType, Object[] paramList)

at Microsoft.Dynamics.Framework.BusinessConnector.Session.DynamicsObjectAdapter.Call(String methodName, Object param1)