Building ASP.NET Applications with C#Builder for Microsoft .NET
- Setting Up an ASP.NET Project
- Environment Overview
- Building a Web Form
- Coding the Application
- Using the HTML Editor
- Improving Your ASP.NET Application
This article focuses on C#Builder support for ASP.NET. C#Builder offers several useful tools for setting up and designing a graphical user interface via drag-and-drop. While designing a page, you'll see how easily C#Builder adds tables and controls and implements data access. It's simple to switch between design view and code, and you get both an HTML editor and a C# code editor for adding logic to your application. You also have access to options that help you manage an application's configuration. This article goes beyond what's available in the documentation by filling in gaps and offering tips and tricks that I've learned along the way.
Setting Up an ASP.NET Project
Starting off with the C#Builder IDE open, select File, New, Other to bring up the New Items dialog box (see Figure 1).
Figure 1 The New Items dialog box lets you select the type of project you want to create with C#Builder. Selecting an item launches a wizard that starts you off with a template of the selected project type.
At this point, it's tempting to just select the project type you want to develop and step through the wizard. For experimenting with the IDE and quick samples, this method is fine, but I prefer having more control over where and how my projects are generated. Just selecting a project type and accepting the default locations to save files will leave you with project groups and projects in the same directory. So the first thing I do in the New Items dialog box is select the Other Files folder and then select Project Group.
TIP
A project group is the top level in the project management hierarchy and exists as a way to group multiple projects in a single workspace. I want my file structure to reflect this hierarchy; the technique I just described creates a blank project group exactly where I want it.
I begin adding projects to my new project group by selecting File, New, Other, selecting the C# ASP Projects folder, and double-clicking the ASP.NET Web Application icon to run the wizard (see Figure 2).
Figure 2 The New ASP.NET Application dialog box allows you to customize the setup of an ASP.NET application. Salient features include selection of physical directory and choice of web server.
One of the things I like about the ASP.NET project wizard is the ability to specify where my files will be located. This may not seem important to some people. However, if you've worked with an editor or tool that doesn't give you this option, you would appreciate not having to manually create a physical directory where you want your project located and then having to create a virtual directory in IIS.
Another notable feature of the New ASP.NET Application dialog box is a choice of web server. The default is using IIS and providing configuration options for the virtual directory. You can also select the Cassini web server, which is an open source project developed by the Microsoft ASP.NET team. You can find the source code for Cassini in the C:\Program Files\Borland\BDS\1.0\Examples\C#\Cassini directory (exact location can vary, depending on C#Builder installation choices).