How to register custom control in Dotnetnuke 8

80 views Asked by At

I have created a class file with content:

  namespace Controls
{
    public class RadioButtonListCustomer : RadioButtonList
    {
        protected override void RenderItem(System.Web.UI.WebControls.ListItemType itemType, int repeatIndex, System.Web.UI.WebControls.RepeatInfo repeatInfo, System.Web.UI.HtmlTextWriter writer)
        {
            writer.Write("<td>");
            base.RenderItem(itemType, repeatIndex, repeatInfo, writer);
            writer.Write("</td>");
        }
    }
}

Register controls.

<%@ Register Assembly="DotNetNuke.Web" TagPrefix="ww" Namespace="Controls" %>

Call controls:

<ww:RadioButtonListCustomer ID="irblUsers" runat="server">
</ww:RadioButtonListCustomer>

RadioButtonListCustomer is not found, so when run application, i get a error:

System.Web.HttpParseException: Unknown server tag 'ww:RadioButtonListCustomer'. ---> System.Web.HttpException: Unknown server tag 'ww:RadioButtonListCustomer'.

1

There are 1 answers

0
Mitchel Sellers On

Starting with DNN 8.x and later, the application is now precompiled, which means that items outside of app_code will not be automatically included inside of the DotNetNuke.Web assembly.

If you change your register tag to be the following

I believe it will be able to find your control. This is assuming that you have your control defined inside of the App_Code folder.

I would recommend for better reusability in the long term that you create your own assembly and deploy in that manner though, it makes things easier later.