Salesforce

How Do I Bind the Data View to a .NET Control (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Bind the Data View to a .NET Control? (Magic xpa 3.x)

You can bind the task data view to a .NET control (such as a grid control) and use it instead of the built-in Table control.

Since there can be many .NET controls on the form, you need to specify which .NET control will show and manage the task data view.

This definition is done in the Dataview Control property (in the control on the form or in the model level).

Note that this property is enabled if the DataSource property name property has a value and the DisplayMember property name and ValueMember property name properties do not have a value.

When the value of this property is set to Yes, you can define the variables that should be seen in the .NET control by zooming into the Dataview Control Fields property.

At runtime, a .NET System.Data.DataTable object will be automatically created out of the task data view and this object will be attached to the .NET control’s property that was defined in the DataSource property name property at the model level.

Any change in the Magic xpa variables will be seen on the .NET control and vice versa.

Note: This functionality is for Online tasks only.

To create a program that uses a .NET dataview control to view a data source’s content:

  1. Create a model with GUI Display Class and set its Attribute to .NET.

  2. Open the property sheet of the .NET control model.

  3. Set the Object Type property to a .NET control that supports DataSource objects, such as System.Windows.Forms.DataGrid.

  4. Set the DataSource property name property to the property that should get the data, such as DataSource.

  5. Set the Dataview Control property to Yes. (This can be done instead in the control properties on the form.)

  6. Create a new program.

  7. Open the program’s properties and set the Preload View to Yes.

  8. Define the program’s data view. (Add a data source and some columns.)

  9. Go to the form of the program and put a .NET control on the form.

  10. Assign the new model as the control’s model or assign the .NET variable to the control’s .NET Object property.

  11. Open the property sheet of the control.

  12. Zoom into the Dataview Control Fields property and define the order of the variables that will be added to the DataTable object attached to the .NET control. A value of zero means that the variable will not be available for the .NET control.

That’s it; you can now run the program and see that the data view is bound to the DataGrid .NET control.

Any navigation between the rows or data update in the .NET control will automatically be reflected in the Magic xpa variables and vice versa.

Since version: 2.3

See also

The Online Samples project (program NE12)

Reference
Attachment 
Attachment