Translations of this page: en bg cs de fi fr hu it ja pl ru tr zh

PunBB.NET extensions are a set of event handlers. All extensions use partial class Extension, which can be found in PunBB.Helpers namespace.

Methods of this class can be both EventHandlers and usual functions.

In order to define a class for which you are creating a handler, you should write the following Method Attribute ExtendClass(Class name).

In order do define the events you are going to handle, use Method Attribute HandleEvent(Event name)

Here is an example of extension, which writes the names of all the controls used on Default.aspx page to it after it’s loading has been completed

namespace PunBB.Helpers
{
    public partial class Extension
    {
        [ExtendClass("PunBB.Default")]
        [HandleEvent("LoadComplete")]
        public void pun_test(object sender, EventArgs e)
        {
            PunPage page = (PunPage)sender;
            page.Response.Write(string.Format("We've {0} controls on this page.<BR/>",page.Form.Controls.Count));
            foreach (Control i in page.Form.Controls)
            {
                page.Response.Write(string.Format("We've {0} control on page. This control is an object of {1} class.<BR/>", i.ID, i.GetType()));
            }
            page.Response.Write(string.Format("sitemap provider is {0}</BR>", SiteMap.Provider.Name));
        }
    }  
}

Personal Tools