layui + three-tier architecture + ajax export Excel function

And FIG direct effect on the source code:

1. First, select all the data, and then click Export

 

2. use a front end value ui

  Using the UI can not understand the detailed documentation Quguan network connection: https: //www.layui.com

 

3. This is the background document controller must be introduced, vs tool can be - (inside search)> Package Manager Settings -> NuGet package management

 

4. This is the code behind event, to query data from the layer into the dal list set, the header defined above

 

The above is the data cycle, the data cycle, which go into the table

 

6, here is the definition of a folder path to get the base directory of the project, how the project file is not the default folder to create a folder named: Uploadss, followed by the name of the table to add Excel file, (note get to the base directory behind the "\\" slash must be added).

 

7. Here, the path 6 back to the front, where the return value by calling

  Success: function () {
    window.location.href = "/ Left_D / DataExcel"; // skip method of deriving
  }

  We're done!

8. Finally renderings

 

9. Open results

  

 

  to sum up:

    Although various examples to find online, all similar but different wording calls in different ways, and finally their own for their own is useful!

Guess you like

Origin www.cnblogs.com/liuchunlin/p/11583835.html