Creating a Data-Driven Web Site (Almost) Automatically

If you have a database of some type and need to create ASP.NET web pages to allow users to list, add, edit or delete records from that database, you have a couple of choices. One way is to design and code all the pages yourself (making use of any existing routines you may have). That can be very involved — not only do you have to create the user interface, you also have to figure out the best way to access the database, provide for user authentication, web site security, reporting, data import and export — a whole list of necessary features. In many cases there may be an easier way — an ASP.NET code generator.

There are various code generators available, ranging from simple template types to very sophisticated programs like IronSpeed Designer. Some of these generators offer only minimal help and some are excellent products, but come with a high price tag. I’ve tried several different ones and finally decided on ASP.NET Maker (www.hkvstore.com). It’s reasonably priced at $200 and includes free download of any minor upgrades for 12 months. It works with Microsoft Access, Microsoft SQL Server, MySQL, Oracle or any other database that supports ODBC or ADO connectivity, and just by selecting various options on screen you can generate a full set of web pages to list, add, edit, delete, or search for database records. You can also set up a user registration system, advanced security features, file uploading, simple reports and exporting of data to csv, Excel or Word files.

Need some extra functionality? You can do that too. ASP.NET Maker gives you the option to enter your own custom code (in either VB.NET or C#) for various pre-defined server events (such as “Page_Loading” or “Row_Deleting”). Your code can be stored as part of the.aspx web page or you can select to use a separate “code behind” file. You can also enter Javascript to handle client-side processing like custom form validation. All your custom code is saved as part of the project you’re working on and is automatically included each time you make changes to the project and re-generate your web page(s).

I should mention that ASP.NET Maker uses HTML controls, not asp.net web controls. If you want to use custom code for something other than the server events provided for in ASP.NET Maker, you have a couple of options. There is a switch in the master template file that controls ASP.NET Maker which can be set to add “runat server” to each HTML control; that will allow you to catch certain information on postback. If you’re using a code-behind file and are used to working with regular asp.net controls, you can also add your own form statement. Just insert something like before the statement generated by ASP.NET Maker. Then code your asp.net control(s) inside “form1” and end with a . Once you’ve done that you can manipulate your asp.net controls and the information from those controls in the code-behind page. The only problem is that you’ll need to save your pages that have this kind of customized code and copy them back into your project each time after you re-generate your web pages (to over-write the standard pages ASP.NET Maker creates).

The heart of ASP.NET Maker is the set of screens where you enter the information the system uses to create your web pages:

Data Source Setup:

You use this screen to enter information such as your database type, server name, port (if not the default), user id, password, database name and connection string.

ASP.NET Settings:

This screen lets you set the default date format and whether or not you want to use caching. You can also set various options for file uploading, creation of audit trails, and for form validation processing.

HTML Settings:

This screen lets you enter a title for your website, the character set, font and text size you want to use as a default, a site logo (if you have one), and footer text (if any). There are also tabs which allow you to edit the default theme for your site and the default CSS styles (although I’ve always used the default settings and they seem to work pretty well for our users).

Security Settings:

You can enter a hard-coded administrator ID and password on this screen and you can also set up optional User ID and User Level Advanced Security to protect your data from unauthorized access.

Menu Editor:

The menu editor allows you to modify the default menu that ASP.NET Maker generates for your web site. You can add, edit or delete menu items, move them up or down, hide certain items – even add menu options that redirect to non-ASP.NET Maker pages.

Table Setup:

This is the most complex part of your project setup. The upper section of this page is a grid showing the available options for each table in your database. The lower section of the page contains table-specific options and master/detail setup information for whichever table is currently selected. You can select which tables you want to generate web pages for, what caption you want to display for each field in the table, whether of not you want to apply a filter to the records in the table, how you want the records sorted, and a variety of other items such as whether you want to enable inline add, edit and copy, whether you want to use CAPTCHA on the add page to prevent automated posting, and whether you want to allow updating of multiple records at the same time.

Generate Settings:

This is where you specify the location of your source files and the destination folder for the generated asp.net files. You can also select to automatically browse your web pages once they have been created since ASP.NET Maker uses a copy of the freeware Cassini web server to run asp.net pages.

ASP.NET Maker also comes with a fairly comprehensive help file which covers how to create your project step by step. In addition, the help file includes brief tutorials on master/detail files, file uploading, user registration, advanced security options, custom views, and creating simple reports.

I’ve actually used ASP.NET Maker to generate the majority of the code for a human resources package and for a time clock system. It won’t do all the work for you, but if you’re looking for a quick way to develop a data driven web site with minimal hand coding, ASP.NET Maker may be worth looking into. It has limitations, but it does pretty much what it claims to do and it seems very stable — thanks no doubt to the sizable number of people who use it and have beaten most of the bugs out of it.

I’ve covered the main points in this article, but it’s basically just a quick overview of the product. If you’re interested getting a little more in-depth look at ASP.NET Maker, you can download a trial version at http://www.hkvstore.com.



Source by Paul Love

Leave a Reply