Make a memo for future development of dynamic pages.
Objectdatasource)
Business Object Name and data object name to be bound
- The business object is actually a class object that contains the specific operation methods of the data table. Most of these methods include data objects as parameters for transmission.
- A data object contains a set of attributes of the same name as a data table field, used to pass values between the page and the database.
The data source can use four main data table operation method names (select, update, insert, delete). These methods are included in the business object, and the data source can also define other event names, all event methods are in the background file.
Formview is a view with the data submission function. It is an encapsulation of form labels on HTML pages. It mainly provides creation and maintenance, and can contain four templates: Edit, insert, item, and empty, the formview page is displayed in different statuses using different templates. After a data source is specified, formview is associated with objectdatasource so that different templates are automatically bound to the corresponding methods of the data source.
- The Edit template is used for data maintenance during update, including related controls, including the SAVE and cancel buttons. Existing records are specified by using the gridview or other methods, after switching to the edit template, the Select method of the data source is automatically executed. After obtaining the data object, bind the control in the template to display the record value. After you modify the data, click Save to execute the data source update method.
- The insert template is used to create record data input, including related controls, including the insert and cancel buttons. After switching, all controls are initialized. After the data input is complete, click the insert button to execute the insert method of the data source.
- The item template is used to display the data of a specified record. It is generally null and contains a new button. It is used to switch to the insert template and run select to display the record content.
- The empty template is used on the interface when no record is specified. It is generally blank and contains a new button to switch to the insert template.
In formview, all templates with data tables to write must contain controls consistent with the data object and bind relevant properties of the data object,
If some data does not need to be rendered, you must bind the property with a hidden control (hidden) because the binding mechanism of. NET must be bound to all the attributes of the data object; otherwise, an error occurs.
When binding data, you can use macro-like function intervention to bind data to meet different requirements, such as formatting the date display.
CodeExample (controls are bound to Data Object Attributes)
Value = '<% # BIND ("startdate") %>' bidirectional binding, which can be understood as read/write
Value = '<% # eval ("startdate") %>' display binding, which can be understood as read-only
TEXT = '<% # obj. Format (eval ("startdate") %>' format after date display is bound
TEXT = '<% # Wai. getgroupname (eval ("deptcode") display after binding
As you can see from the example, the front-end display BIND uses background objects and methods for processing.
In most data systems, operations related to databases are similar to the insert (new), update (maintenance), delete, and query of records. From a functional perspective, in addition to querying, other operations can only be used as data maintenance, and can only be authorized to data maintenance personnel, while querying
Pages are generally used to query, view, and collect statistics for general users.
The binding mechanism of the gridview is similar to that of the formview.