Bullschmidt.com


     Home
     Web Database Concept
     How We Work Together
     Bio
     Web Database Sample
     Classic ASP Design Tips
     Bar Chart Tool
     Web Design Resources
     Access Database Sample

Classic ASP Design Tips

These are opinions of J. Paul Schmidt, MBA.
No warranties are either expressed or implied.
To Use Paul's Services: Paul@Bullschmidt.com

I n p u t   P a g e s   T i p s

Fill a listbox possibly with multiple columns with data from a database.  (More...)


Use dependent listboxes for example to let a user choose a rep in a reps listbox and then have only the customers for that rep be shown in the customers listbox.  (More...)


For a Delete button or link use a JavaScript confirm box to ask "Are you sure you want to delete?"  (More...)


When many hyperlinked records are shown on the same page, put the unique ID field into a querystring within each link.  (More...)


And dealing with checkboxes can be a little tricky either from a posted form or from a field in a database.  (More...)


Make calculated read-only fields have inverted colors (white text on a dark background).  Example: <input type="text" name="InvSubtotal" size="13" readonly="true" style="color:white; background-color:gray" value="<%= InvSubtotal %>">


Perhaps have Web pages "post back" to themselves and then handle further processing from there.  (More...)


If you use a login page, store the user level in a session variable and have each page check for the appropriate level.  (More...)


Sometimes you might need a shopping cart(More...)


Perhaps create a way for certain users to upload files such as images.  (More...)


For dates show all four year digits such as 1/1/2017.  And if the site is global in nature perhaps spell out the first three letters of the month and put the day part before the month part such as 01-Jan-2017.


Keep Web page field and variable names the same as the field names in the database.  Example: <input type="text" name="InvID" value="<%= InvID %>">

Add an initial blank row to most listboxes so that the initial default value can be blank.  Example: <option value="">

Generally use a rounding function when multiplying or dividing.  Example using 2 decimal places: MyVar3 = Round(MyVar1 / MyVar2, 2)

Use tabindex within input tags so that users can tab through the fields in the desired order.  Actually this is only necessary if the default order is not correct.  Example: <input type="text" name="InvID" size="10" maxlength="10" value="<%= InvID %>" tabindex="1">

R e p o r t s   T i p s

Update cumulative variables after each row in a report.  Then at the end of the report show these variables as the totals.  The same concept can also be used for group totals by setting the cumulative variables back to 0 after each group.  Example: InvSubtotalCum = InvSubtotalCum + InvSubtotal


Your report can group data such as showing a category name and then all the items within that category.  (More...)


Sometimes you may want a recordset to display multiple records in each row(More...)


Perhaps allow searching criteria on multiple fields.  (More...)


Sometimes a barchart can tell the story better than regular text ever could.  (More...)


Perhaps make it so that if a user prints a page that some things such as the top title portion, the left menu portion (as this can really expand the width of a printed page), and the bottom footer portion do not print(More...)


In reports show rows with alternating background colors of white <tr style="background-color:#FFFFFF"> and very light gray <tr style="background-color:#EEEEEE">.  And perhaps show the header in a little darker gray <tr style="background-color:#DDDDDD">.


Make column headings have vertical alignment of bottom.  In this way long headings that take up two rows of space don't force the short headings to have a row of space below the words.  Example: <td valign="bottom">My Column Header</td>


Right align number columns so that the decimals generally line up.  Example: <td align="right"><%= FormatCurrency(objRS("Price"), 2) %></td>


At the top show what criteria were used to open a page that shows many records.  Example output: Inv. Date = 1/1/2017 to 5/26/2017, Customer = API


Have checkbox fields appear as "Yes" or "No" when shown in a report.  Example: <% If CBool(objRS("MyField")) Then Response.Write "Yes" Else Response.Write "No" %>


You might wish to have a listbox that allows the user to sort the records shown on the page by things like the Name, City, or Zip.  (More...)


In the footer of each data-related page show a copyright notice with a serious sounding warning.


Use a 1 pixel high by 1 pixel wide black image for creating variable length lines.  Example: <img src="black.gif" height="1" width="20"> or <img src="black.gif" height="1" width="100%">


Use a 1 pixel high by 1 pixel wide invisible image for spacing purposes when needed.  Example: <img src="invisible.gif" height="10" width="1">

If needed allow searching for keywords on multiple fields.  (More...)

Add a page break (in case the user decides to print) between "big, chunky items" such as separate invoices in a report.  Example: <tr style="page-break-before:always"></tr>

Be careful with e-mail addresses in columns.  Since they have no spaces, long e-mail addresses may force columns to be wider than anticipated.

D a t a b a s e   T i p s

A sample Web database can give you ideas about tying everything together and can even be used as a starting point for a Web project.  (More...)


Perhaps give the database a password such as within Access: Tools | Security | Set Database Password.  And use that password in the connection string such as "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/mydbdir/mydb.asp") & ";Jet OLEDB:Database Password=mypassword;"


During development copy and paste a complicated SQL statement into the query builder within Access to help create and debug it.  Simple example: SELECT * FROM MyTable WHERE CustID='API'


Have a way to lock out users from data-related pages when doing maintenance such as FTPing the database.  (More...)


If you don't have the database located in a folder outside of the www area, then give the database an .asp extension instead of .mdb so that users can't download the database directly (but change to a non-text-based extension when FTPing).  And there are other ways to achieve this same objective if you have complete access to the server.

Give the anonymous Internet user change permission on the folder containing the database.  Otherwise database records can be read but not added or edited.

Writing data stresses a database much more than simply reading data.

For a "quick and dirty" generic ASP open source solution to putting databases on the Web that just requires setting up a configuration page for each table or query and uploading the database to the Web as long as each table has a field with a unique autonumber for each record (and you'll probably also separately want to create login capabilities), perhaps try something like this:
GenericDB by Eli Robillard
www.GenericDB.com
And for a live GenericDB sample for an employees table:
www.erobillard.com/devel/gdb/demos/tblEmployees.asp

M i s c .   T i p s

Sometimes you might need capabilities of showing a Web site in multiple languages(More...)


Since an organization and its Web host may not reside in the same time zone (much less the same country) create a way to adjust the Web host's date/time to be the same as the organization's.  (More...)


Ideally do any long, complicated maintenance on a Web site late at night when there are less users.


To help reuse code, perhaps create an included configuration file called something like config.asp with variables set such as mvarVersionDt, mstrSiteTitle, mstrColorMain, and mintSessionTimeoutMin.  Then these variables could be used on the other Web pages.  (More...)

On each page use functions such as ShowTitle(), ShowMenu(), and ShowFooter(), and have these functions stored in an included file perhaps called menu.asp.

Don't let the browser cache data-related pages.  This is so that the latest data changes will show up each time a page is loaded.  Example toward the top of a page: <% Response.Expires = -1000 %>

Buffer content for performance and so that the database (if there is one) only gets hit with requests from one Web page at a time.  Example toward the top of a page: <% Response.Buffer = True %>

But also flush the buffer perhaps just after the top part of the page which shows the site name and logo.  This lets the user see that indeed a new page (or perhaps the same page of a self posting form) is being processed instead of continually seeing the old page until all of the new page has been dished up by the server.  Example: <% Response.Flush %>

Generally use client-side code such as JavaScript somewhat sparingly as it is dependent upon browser versions and settings.

And don't even think about using VBScript for client-side script because it would only work in Microsoft browsers.  Instead generally use JavaScript for client-side script and VBScript for server-side script.

If using secure sockets layer (SSL) on sensitive pages, have the ability in an included configuration file to "turn this off" for when doing work on the development machine.

Keep image sizes small on non-cached, data-related pages since the images have to be downladed from the server each time a page is loaded.

Generally check that Web pages look and work alright on both IE and Firefox browsers.

Occasionally check the VBScript language reference for help with specific syntax.  (More...)

When using animated images keep the animation speed fairly slow so that they are not too annoying.

Of course too many special effects can be a little distracting.

And finally make sure that text is easily readable otherwisit might not get read.


Without these classic ASP design tips I would be such a mess!




To Use Paul's Services:
Paul@Bullschmidt.com

Let's put some data on the Web!
Copyright © 2000-2017
J. Paul Schmidt, MBA
Freelance Web and Database Developer
All Rights Reserved

Privacy Policy