The question is proposed: As shown in the figure below, you need to use the multi-level menu input address, which specifically has the following requirements:
(1) When a list item is selected, the next list of the corresponding list is available for user selection. For example, when the provincial region selection "Hubei Province", there can only be available in Hubei Province in the municipal area of Hubei Province. When the provincial region is replaced into "Hunan Province", the municipal area list should be updated as All municipal regions in Hunan Province are available. Therefore, this three-level list is linkage.
(2) The page cannot be refreshed during the selection address. The refresh page is actually just a look, that is, the user feels that the page is refreshed. It is essentially the user who needs to access the server-side database in the process of selecting the multi-level address. Re-load the page, slower speed, let the user Feeling the page has a process of refreshing, such as the selection of the provincial region to "Hubei Province" needs to read the municipal-level region list from the database from Hubei Province to generate the municipal level list, so there is a page refresh process. In order not to refresh the page, you must save the data in the client, so you do not need to access the server when you update the multi-level list.
The illustration is a solution to the address problem using the multi-level list: the client can save data in two places, which is saved in the page file, encodes all the addresses to the ASPX file, but the ASPX file will be very large, And artificially encode so many addresses to the ASPX files too large, and the page static encoding cannot achieve multi-level list linkage. Second, save the data in the JavaScript script, and use the JavaScript script as a run program to implement multiple levels of lists. In order to reduce the amount of code, this system uses dynamic javascript, add an ASPX page, read the three-level address information from the database with its background program, dynamically generate the JavaScript script, and then send it as a JavaScript file to the client. In this example, the background program ispx.cs is only 173 lines, and the dynamic JavaScript file it generates has 4643 lines, which greatly reduces the workload of the programmer. This JavaScript is sent to the client, which can be greatly implemented without refreshing. This method is cleverly generates JavaScript using the ASPX page, which reduces the amount of code.