Toolbar Plugin Woes

Topics: Developer Forum, User Forum
Apr 13, 2009 at 2:44 PM
I am still trying to learn N2 and I am having problems getting a toolbar plugin to appear.  I started with the C# example and added a modified version of the Go plugin files, but the plugin will not appear in the toolbar.  The files look like this:



@ Page Language="C#" AutoEventWireup="true" CodeFile="Go.aspx.cs" Inherits="Go" %>





ToolbarPlugin("", "", "~/Go.aspx?selected={selected}", N2.Edit.ToolbarArea.Preview, "_top", "eye.png", 0, Name = "Go")]
public partial class Go : N2.Edit.Web.EditPage
    protected override void OnInit(EventArgs e)


Is there some other initialization needed to make the image appear in the toolbar?

Your help is greatly appreciated.

Apr 16, 2009 at 8:47 PM
It should work without anything else. Have you placed eye.png at /edit/eye.png?
Apr 17, 2009 at 9:14 AM
jcomet: I have the start of my own addon I can email which puts the toolbar plugin icon up in the toolbar.

Here is a break downl; essentially I created my addon folder (myAddon) within ~/Addons/

Then add the Items folder which contains your item (obviously) then I added my plugin display to the Plugins folder (~/Addons/<myAddonName>/Plugins/(we'll call this myAddonDisplay.aspx). Here is a snippet from the top of the file:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnquiryList.aspx.cs" Inherits="N2.Addons.EnquiryManager.Plugins.EnquiryManager" %>

Then in the code behind for this file:

    [ToolbarPlugin( // The toolbar plugin attribute tells N2 to put an icon in the toolbar
        "", // we don't want any text (only icon)
        "myAddon", // this is a string that uniquely identifies the plugin
        ToolbarArea.Preview, // we want to put the icon the right hand toolbar area
        "preview", // this is the preview frame
        "~/Addons/myAddon/UI/Img/enquiry.png", // the icon to show in the toolbar
        1000)] // the order in the toolbar
    public partial class myAddon: EditPage

From chatting with esteewhy yesterday I also found this out (re: addons) which I didn't know:

Where should I create my functionality?

You should create each snippet/mini application in the ~/Addons folder.

-> Items
-> Plugins
-> UI
    -> Parts
    -> Views

Functionality that is linked can be packaged within the same parent folder:


~/Addons is used by convention, technically any folder name can be used, but if we all stick to Addons then namespaces make sense I guess. I think it's only the sub folders that matter (Items, UI etc).

Hope this helps. :)

Apr 18, 2009 at 1:18 AM

Wow - thanks for the info.   I am going to try the addon approach tonight.

As for my original problem with the ToolbarPlugin, I researched the code and found the issue is related to how the plugin finders work.  I surmised that the finders could't locate my plugin because of they way website assemblies are built.  I merely converted my project to a web application project and the plugin showed up.