AxFilterControl
If the ShowFilter property of AxGridview is set to true, AxGridView embeds AxFilterControl. AxFilterControl is displayed at the top of AxGridView. AxFilterControl reads the metadata from the AxDataSourceControl the AxGridView
is binding to and displays controls dynamically to allow the user to
filter the data source with any of its field that are not hidden or
locked. You can access the filter control through the AxGridView FilterControl property and the filter XML through Filter.
The filter control sets the filter on AxDataSetView using AxDataSourceView, which is responsible for keeping the data in sync with the filter set by calling SetAsChanged and ExecuteQuery if data has changed. AxDataSourceView and DataSetView expose the SystemFilter and UserFilter properties and the ResetUserFilter method APIs for the filter control to set the filter programmatically.
For example, you can set the range in the data set in X++ as follows.
qbrBlocked = qbds.addRange(fieldnum(CustTable,Blocked));qbrBlocked.value(queryValue-
(CustVendorBlocked::No));qbrBlocked.status(RangeStatus::Hidden);
|
In the Web User Control, you can read the SystemFilter set on the data source.
this.AxDataSource1.GetDataSourceView(this.AxGridView1.DataMember).SystemFilter.ToXml()
|
or
this.AxDataSource1.GetDataSet().DataSetViews[this.AxGridView1.DataMember].
SystemFilter.ToXml();
|
returns
<?xml version="1.0" encoding="utf-16"?><filter xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CustTable">-
<condition attribute="Blocked" operator="eq" value="No" status="hidden" /></filter>
|
DataSourceView and DataSetView have the following methods, which allow you to read the different types of filters and reset them.
SystemFilter gets the complete list of ranges on the query, including open, hidden, and locked, into the conditionCollection on the filter object.
UserFilter gets only the open ranges on the QueryRun into the conditionCollection on the filter object.
ResetFilter method clears the filter set on the QueryRun and thus resets to the filter (ranges) set programmatically.
Here is a code snippet to set the filter programmatically.
this.AxDataSource1.GetDataSourceView(this.AxGridView1.DataMember).SystemFilter.AddXml-
(@"<filter name='CustTable'><condition attribute='CustGroup' status='open' value='10'
operator='eq' /></filter>");
|
AxForm
AxForm displays
a single record from a data source, where each data row represents a
field in the record. The first column in the row often displays the name
of the field, and the second column displays the value of the field for
the record. The AxForm control allows you to view, create, and update a single record.
AxForm is a data-bound control with built-in data modification capabilities. When you use AxForm with the declarative AxDataSource
control, you can easily configure it to display and modify data without
needing to write any code. It also provides a rich set of properties,
methods, and events you can customize with application-specific user
interface logic.
The DataSourceID, DataMember, and DataKeyNames properties define the data-binding capabilities of the AxForm control. AxForm also provides properties to autogenerate action buttons, setting their text and the mode. You set the UpdateOnPostback property if you want the record cursor to be updated at post back so that other controls can read the change. AxForm
also provides events for all the actions that can be taken on the form
before and after that action is completed. You can write code in these
events for user interface or application-specific logic before or after
the action is completed.
The AxForm
control is a container for a collection of controls. If your form
contains many fields and requires visually grouping the related fields,
allowing them to be expanded or collapsed, you use the AxMultiSection control inside the AxForm control. If your form is simple and has only a few fields, you can use the AxGroup control.
AxMultiSection
AxMultiSection allows you to define a collection of AxSection controls, where each AxSection
control contains child controls. By default, all sections are in
expanded mode and rendered vertically, one after the other. Users can
keep any number of them in expanded or collapsed mode. You can also
configure AxMultiSection so that only
one section is expanded at any point. In this mode, expanding a second
section causes the first one to collapse, keeping just one section
active. Set the ActiveMode property to true to enable that behavior. You use the ActiveSectionIndex property to get or set the active section. The AxMultiSection component can contain only AxSection components.
AxSection
AxSection is a generic control container. Any control can be a child of AxSection. All AxSection controls are rendered vertically, one after the other. Each AxSection
includes a header that contains the title of the section and an image
button that allows the user to expand or collapse the section. AxSection provides properties to display or hide the header and border. You can also set a security key on AxSection
so that it’s visible only to users who have access to that security key
in Dynamics AX. You can also write code when the section is expanded or
collapsed through the events exposed by AxSection.