Implement ASP. NET multi-data offline editing

Source: Internet
Author: User

No nonsense. This post provides an ASP. net sample download, which includes five features: Multi-edit + offline edit + multi-person concurrent write conflict detection (concurrent) + batch write database + retain user input values in the gridview 」.

A few days ago, I want to convert the old system over a decade ago into a web interface and rewrite the code. To match the customer's operational habits, you must be able to provide the "offline" editing function, that is, the user must
Multiple "create, modify, and delete" content made by ASP. NET must be saved in the memory. It is not written back to the database until a "save Parameters" button is clicked.

-------------------------------------------------
Example download point of this post:
Http://files.cnblogs.com/WizardWu/090225.zip
(In this example, vs 2008, IIS, and SQL Server databases are required)
-------------------------------------------------

The example execution screen is as follows:

* Function 1: Multiple edits
* Function 2: offline editing (this is the most difficult)
* Function 3: multi-user concurrent write conflict detection (concurrent. You can test this function by enabling two browsers to execute this example)
* Function 4: Write Data in batches (batch) to the database + transaction
* Function 5: retain the user's input value in the gridview

Function Description:

* Function 1: Multiple edits:
That is, each row of the gridview can be entered in each column. This is nothing, so it is annoying for the customers and the features required by the SA. Another
Controls for each row and column of the gridview, such as Textbox, can still be used with validator or Ajax
Filteredtextboxextender and other controls for user input verification.

* Function 2: offline Editing:
For example, if you click the "add" button on the right of the orange row, the user will not write data to the database, but will
Input creation data, stored in the memory datatable
You can create multiple records continuously. You need to wait until you click the "save" button in the lower-left corner to write all the "create, modify, and delete" data that you have previously created to the database at a time to simulate
The operating mode of the old system.

* Function 3: Concurrent ):
Discard the objectdatasource control's
Use the modify_dt function in the data table.
Field to determine whether the record is at the same time. Two or more people want to edit the same record in the database at the same time. If yes, only the first creator can write the data to the database correctly. After the data is successfully stored, the current time will be written together.
The modify_dt field of the database; the latter will be forced to give up. You must leave this page before returning to obtain the latest modify_dt field in the database.
The latest time of the field before it can be stored.

* Function 4: Batch write to database + transaction:
It is a single "create, modify, delete" multiple records to the database, and add the Database "transaction", which is nothing, you only need to concatenate Multiple SQL statements with semicolons. Wei
1. The parameter names in multiple statements must be unique.

* Function 5: retain the user's input values in the gridview:
Because the "Create" function is embedded in the footerrow of the gridview
When you press the "add" button, you must execute gridview. databind () to display the created results in the gridview
. However, this will cause the user
The input values of other existing data rows are lost, resulting in operation inconvenience. Therefore, after you press the Add button, save the input values of each control in other data rows to a datatable
Wait until the gridview. databind (), and then fill in all values from this able back to each column in each row of the gridview.

Recently, I have developed some small systems, but I have no chance to use more advanced frameworks or the latest and most dazzling new technologies. However, I have to work hard with some hard work, to meet unreasonable requirements of customers and SA.

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.