Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Architecture
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
Bing
BizTalk
Book Excerpts
Build and Deploy
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Design Patterns
Development Process
Display Technologies
Distributed Computing
DotNetNuke
DSL
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
Internet Explorer 8.0
Interviews
iPhone
Iron Ruby
Java
Java Script
jQuery
LINQ
Linux
Mac OS X
MDX
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
Network
NHibernate
Object Oriented Development
Odata
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
Podcasts
Post Mortem
PowerPoint
Print/Output
Prism
Product News
Product Reviews
Project Management
Python
Q&A
Rails
Rake
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Search
Security
Services
SharePoint
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server CE/AnyWhere/Mobile/Compact
SSIS
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
Tips
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WF
Whitepapers
Windows 7
Windows Azure
Windows Live
Windows Server
Windows Vista
WinForms
Workflow
WPF
XAML
XML
XNA
XSLT



QCon


 


DevReach

Reader rating:
Click here to read 15 comments about this article.
Article source: CoDe (2004 - March/April)


Article Pages: < Previous - 1  2  3 4 - Next >


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.

Click for a larger version of this image.

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.

Click for a larger version of this image.

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.

Click for a larger version of this image.

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

Click for a larger version of this image.

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.

Click for a larger version of this image.

Figure 5: Typical sequence of events.

&


Book: The Wiki Way: Collaboration and Sharing on the Internet

More information about Wikis and the general philosophy behind them can be found in this book by Bo Leuf and Ward Cunningham. ISBN 020171499X.



Listing 1: Method in the Default.aspx Web page to display topic information
Private Sub DisplayTopic()

If Me.chkPageInEditMode.Checked Then

            Me.PageHeader.EnableLinks = False

            Me.txtPageContent.Visible = True
            Me.lblPageContent.Visible = False
            Me.lblPageContent.Text = ""
            Me.cmdEdit.Visible = False
            Me.cmdSave.Visible = True
            Me.cmdSaveAndContinue.Visible = True
            Me.cmdCancel.Visible = True
            Me.txtViewHistory.Visible = False
            Me.txtAddPicture.Visible = False

            Me.txtPageContent.Text= ReadTopic(Me.lblPageTopic.Text)
            Me.lblPageContent.Text = ""

        Else

            Me.PageHeader.EnableLinks = True

            Me.txtPageContent.Visible = False
            Me.txtPageContent.Text = ""
            Me.lblPageContent.Visible = True
            Me.cmdEdit.Visible = True
            Me.cmdSave.Visible = False
            Me.cmdSaveAndContinue.Visible = False
            Me.cmdCancel.Visible = False
            Me.txtViewHistory.Visible = True
            Me.txtAddPicture.Visible = True

            Dim Content As String = ReadTopic(Me.lblPageTopic.Text)
            Me.lblPageContent.Text = WikiText(Content, "")
            Me.txtPageContent.Text = ""

        End If

End Sub


Article Pages: < Previous - 1  2  3 4 - Next Page: 'Database' >>

Page 1: Building Wiki Web Sites with ASP.NET and SQL Server.
Page 2: DotWiki Project
Page 3: Database
Page 4: Search Page

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
1.8 out of 5

333 people have rated this article.

      DevConnections

 

QCon