Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Generate ASP.NET+AJAX Web Apps Straight from Your Database

26 Mar 2010 0  
Generate stunning ASP.NET+AJAX web applications with Code OnTime Generator featuring Adaptive Filtering, Membership, Export and Reports in Excel, CSV, RSS, PDF formats. Supports IE 7-8, Safari, Opera, FireFox, Chrome. Try it now!

We would like to share with the world the free ASP.NET code generator that creates stunning ASP.NET+AJAX web applications straight from the database.

The generated applications feature modern Web 2.0 user interface, advanced multi-level menu, security system built on top of Microsoft ASP.NET Membership, complex master-detail page layouts, efficient filtering, paging and sorting of very large datasets, data export in CSV, Excel, and RSS format, instant PDF, Excel, and TIFF reports. The application code base is relying on Microsoft ASP.NET Ajax Extensions and Ajax Control Toolkit. The reports are produced with the free Microsoft Report Viewer.

Generated applications work identically in major browsers including Internet Explorer 7-8, Firefox, Safari, Chrome, and Opera.

The entire source code of the generated applications is included without any external dependencies. You will also find all code generator templates in the source code form as well. Application code is generated in Visual Baisc.NET or C#.

Please follow these instructions to install the ASP.NET code generator and code generation projects:

  1. Download the free code generator at http://codeontime.com or directly from http://store.codeontime.com/install/setup.exe.
  2. Run the installation program and install the code generator.
  3. Start the code generator and click on Install button to install the code generation library. The code generation library includes a collection of XSLT stylesheets, JavaScript files, CSS, and graphics resources. Wait for installation to complete.
  4. In the menu of available code generation projects select the free code generator project Web Site Builder. Follow the instructions to configure the database connection and complete all steps of the project wizard. The end result will look similar to the applications below.

websitefactory_aspnet_ajax.jpg

You will find live demos of the generated applications at http://blog.codeontime.com/2009/11/web-site-factory-preview-3.html.

This tool will benefit anyone interested in learning, prototyping, and implementing AJAX applications for ASP.NET. If you are a database administrator, then you can have an attractive and easy to use application on top of your database in minutes. The generated applications can serve as a great foundation for any new projects.

The following markup represents the code in picture.

image_thumb3.png

<%@ Page Language="C#" 

MasterPageFile="~/Main.master" AutoEventWireup="true" 
    CodeFile="Employees.aspx.cs"
 
Inherits="Pages_Employees" Title="Employees" %>
 
<asp:Content ID="Content1" 

ContentPlaceHolderID="PageHeaderContentPlaceHolder" 
    runat="Server">
 
Employees</asp:Content>
 
<asp:Content ID="Content2" 

ContentPlaceHolderID="PageContentPlaceHolder" runat="Server">
 
<div factory:flow="NewRow" xmlns:factory="urn:codeontime:app-

factory">
 
<div factory:activator="Tab|Employees">
 
<div id="view1" runat="server">
 
</div>
 
<aquarium:DataViewExtender id="view1Extender" runat="server" 

TargetControlID="view1"
 
Controller="Employees" view="grid1" ShowInSummary="True" 

/>
 
</div>
 
<div factory:activator="Tab|Employees">
 
<div id="view2" runat="server">
 
</div>
 
<aquarium:DataViewExtender id="view2Extender" runat="server" 

TargetControlID="view2"
 
Controller="Employees" view="grid1" 

FilterSource="view1Extender"
    FilterFields="ReportsTo" />
 
</div>
 
<div factory:activator="Tab|Orders">
 
<div id="view3" runat="server">
 
</div>
 
<aquarium:DataViewExtender id="view3Extender" runat="server" 

TargetControlID="view3"
 
Controller="Orders" view="grid1" 

FilterSource="view1Extender" FilterFields="EmployeeID" />
 
</div>
 
<div factory:activator="Tab|Employee Territories">
 
<div id="view4" runat="server">
 
</div>
 
<aquarium:DataViewExtender id="view4Extender" runat="server" 

TargetControlID="view4"
 
Controller="EmployeeTerritories" view="grid1" 

FilterSource="view1Extender"
    FilterFields="EmployeeID" />
 
</div>
 
</div>
 
</asp:Content>
 
<asp:Content ID="Content3" 

ContentPlaceHolderID="SideBarPlaceHolder" runat="Server">
 
<div class="TaskBox">
 
<div class="Inner">
 
<div class="Header">
 
About</div>
 
<div class="Value">
 
This page allows employees management.</div>
 
</div>
 
</div>
 
</asp:Content>

The single set of code generation templates produces the equivalent application in C# and VB.NET.

This is a sample of the code generation template that creates one of the files of application framework in the foundation of the generated applications.

<?xml version="1.0" encoding="utf-8"?>
 
<xsl:stylesheet version="1.0" 

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
xmlns="http://www.codeontime.com/2008/codedom-compiler" 
    xmlns:a="urn:schemas-codeontime-com:data-aquarium-project"
 
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-

prefixes="msxsl a"
 
>
 
<xsl:output method="xml" indent="yes"/>
 
<xsl:template match="/">
 
<compileUnit namespace="{a:project/a:namespace}.Data">
 
<imports>
 
<namespaceImport name="System"/>
 
<namespaceImport name="System.Collections.Generic"/>
 
<namespaceImport name="System.ComponentModel"/>
 
<namespaceImport name="System.Data"/>
 
<namespaceImport name="System.Data.Common"/>
 
<namespaceImport name="System.Linq"/>
 
<namespaceImport name="System.Text"/>
 
<namespaceImport name="System.Text.RegularExpressions"/>
 
<namespaceImport name="System.Xml"/>
 
<namespaceImport name="System.Xml.XPath"/>
 
<namespaceImport name="System.Web"/>
 
<namespaceImport name="System.Web.Caching"/>
 
<namespaceImport name="System.Web.Configuration"/>
 
<namespaceImport name="System.Web.Security"/>
 
</imports>
 
<types>
 
<!-- class View -->
 
<typeDeclaration name="View">
 
<members>
 
<!-- property Id -->
 
<memberField type="System.String" name="id"/>
 
<memberProperty type="System.String" name="Id">
 
<attributes public="true" final="true"/>
 
<getStatements>
 
<methodReturnStatement>
 
<fieldReferenceExpression name="id"/>
 
</methodReturnStatement>
 
</getStatements>
 
</memberProperty>
 
<!-- property Label -->
 
<memberField type="System.String" name="label"/>
 
<memberProperty type="System.String" name="Label">
 
<attributes public="true" final="true"/>
 
<getStatements>
 
<methodReturnStatement>
 
<fieldReferenceExpression name="label"/>
 
</methodReturnStatement>
 
</getStatements>
 
</memberProperty>
 
<!-- property HeaderText -->
 
<memberField type="System.String" name="headerText"/>
 
<memberProperty type="System.String" name="HeaderText">
 
<attributes public="true" final="true"/>
 
<getStatements>
 
<methodReturnStatement>
 
<fieldReferenceExpression name="headerText"/>
 
</methodReturnStatement>
 
</getStatements>
 
</memberProperty>
 
<!-- property Type -->
 
<memberField type="System.String" name="type"/>
 
<memberProperty type="System.String" name="Type">
 
<attributes public="true" final="true"/>
 
<getStatements>
 
<methodReturnStatement>
 
<fieldReferenceExpression name="type"/>
 
</methodReturnStatement>
 
</getStatements>
 
</memberProperty>
 
<!-- constructor View() -->
 
<constructor>
 
<attributes public="true"/>
 
</constructor>
 
<!-- constructor View(XPathNavigator, IXmlNamespaceResolver -->
 
<constructor>
 
<attributes public="true"/>
 
<parameters>
 
<parameter type="XPathNavigator" name="view"/>
 
<parameter type="IXmlNamespaceResolver" name="resolver"/>
 
</parameters>
 
<statements>
 
<assignStatement>
 
<fieldReferenceExpression name="id">
 
<thisReferenceExpression/>
 
</fieldReferenceExpression>
 
<castExpression targetType="System.String">
 
<methodInvokeExpression methodName="Evaluate">
 
<target>
 
<argumentReferenceExpression name="view"/>
 
</target>
 
<parameters>
 
<primitiveExpression value="string(@id)"/>
 
</parameters>
 
</methodInvokeExpression>
 
</castExpression>
 
</assignStatement>
 
<assignStatement>
 
<fieldReferenceExpression name="type">
 
<thisReferenceExpression/>
 
</fieldReferenceExpression>
 
<castExpression targetType="System.String">
 
<methodInvokeExpression methodName="Evaluate">
 
<target>
 
<argumentReferenceExpression name="view"/>
 
</target>
 
<parameters>
 
<primitiveExpression value="string(@type)"/>
 
</parameters>
 
</methodInvokeExpression>
 
</castExpression>
 
</assignStatement>
 
<assignStatement>
 
<fieldReferenceExpression name="label">
 
<thisReferenceExpression/>
 
</fieldReferenceExpression>
 
<castExpression targetType="System.String">
 
<methodInvokeExpression methodName="Evaluate">
 
<target>
 
<argumentReferenceExpression name="view"/>
 
</target>
 
<parameters>
 
<primitiveExpression value="string(@label)"/>
 
</parameters>
 
</methodInvokeExpression>
 
</castExpression>
 
</assignStatement>
 
<assignStatement>
 
<fieldReferenceExpression name="headerText">
 
<thisReferenceExpression/>
 
</fieldReferenceExpression>
 
<castExpression targetType="System.String">
 
<methodInvokeExpression methodName="Evaluate">
 
<target>
 
<argumentReferenceExpression name="view"/>
 
</target>
 
<parameters>
 
<primitiveExpression value="string(c:headerText)"/>
 
<argumentReferenceExpression name="resolver"/>
 
</parameters>
 
</methodInvokeExpression>
 
</castExpression>
 
</assignStatement>
 
</statements>
 
</constructor>
 
</members>
 
</typeDeclaration>
 
</types>
 
</compileUnit>
 
</xsl:template>
 
</xsl:stylesheet>

Code generators have long endured bad reputation for the quality of generated applications – not anymore. Use the free Code OnTime Generator and Web Site Builder and prove those still in doubt to be wrong.

Please enjoy.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here