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,CodeAlso rewrite. In order to match the customer's operational habits, you must be able to provide the "offline" editing function, that is, the user must be in ASP. the multiple "create, modify, and delete" content made by. NET must be saved in the memory. It will not be written back to the database until the last "save" 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. In addition, controls for each row and column of the gridview, such as Textbox, can still be used with validator, or Ajax filteredtextboxextender 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 data will not be written to the database. Instead, the data you have created in footerrow will be saved in the memory datatable, you can create multiple records continuously. You must wait until you click the Save OPERATION button in the lower-left corner to write all the previously created, modified, and deleted data to the database at a time, it simulates the operation modes of some ancient old systems.

* Function 3: Concurrent ):
Discard the concurrent function of the objectdatasource control and use a modify_dt field in the data table to determine whether the data is at the same time. Two or more people want to edit the same record in the database at the same time. If so, only the database owner can write data to the database correctly and write the current time to the modify_dt field of the database after the database is successfully stored. The former will be forced to give up, you must leave this page before returning and obtain the latest modify_dt field time in the database.

* 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 the gridview. databind () to display the created result in the gridview in real time. However, this will cause loss of user input values in other existing data rows in the gridview, resulting in inconvenient operation. Therefore, after you press the Add button, save the input values of each control in other data rows to a datatable. after databind (), fill in all the 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.

------------------------
Note:

The comments of the Code are all written in Traditional Chinese (the simplified "rows and columns" are the opposite). The following is a word reference table:

Ma fan

Data-Data
Database-Data sources
Table-data table
Row-column
Column-row
Record-record
Field-delimiter
Transaction
Memory-Reporter
Controls-controls
------------------------

 

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.