Master-slave table data input processing

Source: Internet
Author: User

Master-slave table data input processing

In the previous record storage and display, data is displayed and input in a view. If records in the Master/Slave table are simultaneously input, therefore, the master-slave table must be displayed in two GridView tables for data input. The master-slave table input is more complex. How can this problem be solved?

Here we still use the paging Control for data paging and direct data entry operations. In addition, the Master/Slave table data is added and processed on a GridControl interface at the same time.

In this way, the primary table record is of the dictionary type, and the table is a dictionary detail project. The following figure shows the effect of the data display interface.

Of course, we can directly input data at the bottom, including the master table record and slave table detail record, which can be input and saved in one go, as shown in the following figure.

The master-slave relationship of the GridView needs to set the ing relationship of the set. We need to set the GridLevelNode set to process the master-slave table relationship.

The following code initializes the relationship between GridView2 and the master-slave table in the slave table:

 

Through the above initialization code, after specifying the relationship between the master and slave tables, we also need to perform some processing on the bound data source to display the records of the master-slave table relationship on the GridControl control.

First, define a business object to store the record objects of the master-slave relationship.

Then, when BindData is bound to data, the code can be processed as follows.

In this way, you can get the effect of the master-slave table interface.

 

The data saving code is similar to the previous operation. We need to process the data saving operations of GridView1 and GridView2 respectively, as shown in the following code.

The following describes how to save the dictionary project details of GridView2.

To delete the records of a Master/Slave table, we need to introduce it here because the Master/Slave table shares a right-click menu to delete records.

During the processing, we need to determine whether to operate the records from the table or the master table separately, and then prompt whether the operation is successful. If yes, we can remove this line, avoid losing focus due to data update.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.