This section covers installation of the examples. The requirements for the examples are Visual Studio and Sql Express.
Step 1: Download from CodePlex
The best place to start is in the download section on codeplex. Along the source code there are a number of examples that should speed you right along using N2. This guide will focus on the Templates Examples. This the code of a skeleton project along with compiled versions of the templates and edit interface code. Here's a quick overview of the other released files.
Step 2. Unzip
Now that you've downloaded the Templates Examples unzip and venture into the downloaded goodies. The package includes an Sql Server Express database (mdb file) with a few pages.
If you don't want to use sql express you can install the required tables in another database by configuring the connection string in web.config and following the installation guide located in the /edit/install directory.
Step 3: Open in Visual Studio
As you can see there isn't much in this project. However. There's more, but it's all compiled and not included in the project. If you're new to N2 I can reccoment not digging into the source code just yet. Just play along fow now.
Step 4: Compile and Run (Ctrl+F5)
Hit the universal compile and run command in visual studio Ctrl+F5 to see how this site looks like right now. Visual Studio has a little web server that will serve us just fine right now.
Step 5: Log in and play around
Why not log in and play around a bit. The username/password should be admin/changeme.
Step 6: Look at some code
Back in visual studio you can see two files included in the project. This is the definition of a content item we can use when we edit. For an item to be available for editing you need create a class and decorate it with the [Definition] attribute.
To be able to view it you also need to point out a template from within the definition. This is a template, it has a designer file:
The template uses a master page and a theme which is set at runtime. To change edit the start page.
This is the code-behind file:
Step 7: Verify the example code
Switch back to the browser and create a new item (right click on the startpage and choo new). Notice that there's a choice "My First Page"? That's defined by the code in the example project you just looked at.
When we click on it we start start editing the page. The fields that are there by default are inherited from AbstractContentPage (if you didn't notice before go back to Visual Studion and "MyPagePage.cs" and take a look) .
Okay, lets start programming
- Open up the solution