This project is read-only.

N2 and existsing site

Topics: Developer Forum
Nov 5, 2008 at 3:48 PM
I have ASP site with a lot of data.
For example,
I have issues from user and what to display it on some page with help of DataList.
Also i able to change status of each issue from list and change responsible user.
Issue Id |  Issue Name | Issue Date| Issue Status | Responsible User|
  1          Add file          11.2008     Not Active    Max
  2          Create folder  12.2008     Active           Bob

*(Issue Status and Responsible User are changeable fields)

What is the best way to integrate it with N2?
Nov 5, 2008 at 5:06 PM
The implementation will be very similar to traditional ASP.NET programming. The primary difference will be that you need to expose the data as part of your content item. For example:

public class DefectTrackingPage : CmsContentItem
  public DefectDataSet Defects
      return DefectTracker.GetOpenDefects();

  // ... other code

In your template, simply bind your DataList to ContentItem.Defects.

This is just one example, there are many ways this could be done such as implementing a DefectTracker content item that can be embedded within your page.
Nov 5, 2008 at 8:09 PM
If you have a lot of existing data the ASP.NET data model might work for you. Here's a viedo tutorial and there's lots more on that site.

Once you have a page that displays your data you can integrate it in the CMS. The way to do it is create a class that inherits from N2.ContentItem and override the TemplateUrl property. The property should return the address to the page you created. Here's a description.
Nov 6, 2008 at 10:20 AM
So, as i understand, this way help me to store all item in N2 database.
But i do not want this. I do not want to change location of user data. And i also want to manage data manipulation operation.
So, in general, I want to create class to display and manage external data and put it to some N2 pages with help of CMS system.
How can i do it?
Nov 6, 2008 at 1:12 PM
> I do not want to change location of user data.

You do not have to. As libardo suggested, use the existing ASP.NET data model and simply "point" your content item to a regular ASP.NET page that does what you want. For example:

public abstract class DefectTrackerPage : N2.ContentItem
public override string TemplateUrl
get { return "~/RegularAspDotNetPageWithoutN2.aspx"; }
Nov 6, 2008 at 3:37 PM
Sorry, but i do not understand.
The new site will build on N2 CMS, but some data and control i want to reuse from my old site.
So i do not what to import full page to new site. I just want to add some controls to provide the same functionality.
For ex. i want to make control to display issue for current user.
So what is the best way?
Nov 6, 2008 at 4:06 PM
> I just want to add some controls to provide the same functionality.

Check out the documentation on composition. You will need to create a content item that is not a page and use a Web User Control (ascx file) to display the data. You can then add this component to your page by declaring a property for your page or by using zones.