Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在Dotnetnuke 8中注册自定义控件_C#_Custom Controls_Dotnetnuke_Dotnetnuke 8 - Fatal编程技术网

C# 如何在Dotnetnuke 8中注册自定义控件

C# 如何在Dotnetnuke 8中注册自定义控件,c#,custom-controls,dotnetnuke,dotnetnuke-8,C#,Custom Controls,Dotnetnuke,Dotnetnuke 8,我创建了一个包含以下内容的类文件: namespace Controls { public class RadioButtonListCustomer : RadioButtonList { protected override void RenderItem(System.Web.UI.WebControls.ListItemType itemType, int repeatIndex, System.Web.UI.WebControls.RepeatInf

我创建了一个包含以下内容的类文件:

  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>");
        }
    }
}
命名空间控件
{
公共类RadioButtonList客户:RadioButtonList
{
受保护的覆盖无效RenderItem(System.Web.UI.WebControl.ListItemType itemType,int repeatIndex,System.Web.UI.WebControl.RepeatInfo RepeatInfo,System.Web.UI.HtmlTextWriter writer)
{
作者:写(“”);
RenderItem(itemType、repeatIndex、repeatInfo、writer);
作者:写(“”);
}
}
}
注册控件

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

呼叫控制:

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

未找到RadioButtonListCustomer,因此在运行应用程序时,我收到一个错误:


System.Web.HttpParseException:未知的服务器标记“ww:RadioButtonListCustomer”。-->System.Web.HttpException:未知的服务器标记“ww:RadioButtonListCustomer”。

从DNN 8.x和更高版本开始,应用程序现在已预编译,这意味着应用程序代码之外的项不会自动包含在DotNetNuke.Web程序集中

如果您将注册标签更改为以下内容

我相信它会找到你的控制权。这是假设您在App_Code文件夹中定义了控件

从长远来看,为了更好地重用,我建议您创建自己的程序集并以这种方式进行部署,尽管这样以后事情会变得更容易