Building Wiki Web Sites with ASP.NET and SQL Server. (Cont.) DotWiki Project You can choose from several implementations (Wiki clones) that allow people to host Wiki Web sites. In the following sections I will discuss creating a wiki from scratch. This project will be called DotWiki and will be implemented using ASP.NET, VB.NET, and SQL Server/MSDE. DotWiki Web Pages | " | Words in CamelCase notation follow a pattern in which the first character is an uppercase character, followed by a few lowercase characters, followed by another uppercase character, followed by more lowercase characters.
| " |
The main Web page of the DotWiki is the Default.aspx Web page. On Default.aspx you can display topic information and let users edit their content. Figure 1 shows how this page looks from the developer's perspective.  Figure 1: Default.aspx from the developer's perspective.The Default Web page has a view mode and an edit mode. In view mode the Wiki assigns the topic information to a label control on the page (PageContent in Figure 1) so that the browser can display the information. View mode for this page also makes the Edit button visible and hides the Save and Cancel buttons. Figure 2 shows this in view mode.  Figure 2: Example of a typical page in a view mode. In edit mode (Figure 3), the Wiki assigns the topic information to a textbox control and makes the Save and Cancel buttons visible. The text control on this page is a multi-line control so that it automatically stretches to display multiple lines of text. Listing 1 shows the main method used by Default.aspx to display topic information.  Figure 3: Example of a typical page in edit mode. Other pages that support the DotWiki project include an Index page that displays the list of topics in the database, a RecentChanges page that displays the topics that have changes in the last 24 hours, and the Search page that allows users to look for information stored in the database. These basic Web pages have somewhat limited functionality since most of the functionality that powers them resides in the Business Services class. Class Structure of the DotWiki The DotWiki project contains three main classes: - A web page used to display and edit topic information.
- A business object that reads and saves data from the database.
- A parser that performs translations on the text coming from the database before it is displayed.
Figure 4 shows the class diagram of the DotWiki project. I've drawn the main classes with a blue border. DotWiki Mechanics  Figure 4: Class diagram. When users visit the DotWiki, the Wiki loads Default.aspx and automatically loads a topic from the database. When a user clicks on a CamelCase word inside the topic, the Wiki page calls the BusinessObject to load the record corresponding with the clicked CamelCase word. The Default.aspx Web page then calls the Wiki parser to process the topic coming from the business object, and eventually the browser renders the topic. When a user clicks the Edit button, the Default.aspx page switches itself to edit mode and displays the content of the topic in a textbox so that the user can make modifications to the text. When the user clicks the Save button, the Wiki page passes the new text to the Business Object so the text can be sent to the database, and finally the Default.aspx Web page switches back to view mode. Figure 5 illustrates how these classes interact with each other as a user visits the Wiki.  Figure 5: Typical sequence of events. |