Step 1 | Step 2 | Step 3.1 Step 3.2 Step 3.3 |
Step 3.2
Clothing - Static HTML with DATA attribute initialization. Data access
techniques (2).
Load data: | |
---|---|
Data record | Printing |
Read below first! |
Here we use the first label file again the one with no data entries in it (clothing.activelabel). Why so?
Because we want to add the data at a later time - when the user clicks one of the "Add data set" buttons. We use two separate files for them dataset1.activelabel and dataset2.activelabel. They are formed like Active Label files but contain only data entries and nothing else. They are not appropriate for full label initialization, but we can add them to the already initialized label to add some data entries to its internal cache.
In a real world application we will most likely use server side scripts and not refer static files with data entries. For example instead of dataset1.activelabel we can put an ASP page that generates entries and refer the page with some query string parameters that will tell it what data we need from the database. Depending on how the application is structured it is possible to invoke this data addition automatically as consequence of another user action. The key is that this technique does not need the HTML page to be reloaded - if you have a situation where you want the page to stay unchanged and only the label data to change you can try this approach. Most likely this will be a scenario involving frames where the major part of the interaction with the WEB server is done in one frame and the other frames are rarely (if ever) reloaded.
Note that the "Add" buttons above only add entries not cleaning the cache before that. In most cases you will want it cleared before adding entries.
Now we are prepared to make the next step - change this page to an ASP page. To see the next step in action you will need to put this example on a WEB server or install ALP.