'未知的服务器标签',因为我正在尝试使用自定义控件

时间:2017-10-27 13:11:36

标签: asp.net visual-studio class

我是一个完整的autodidact,之前从未在Visual Studio项目中添加过新类。我现在开始this帖子,这看起来非常酷,因此想要实现所描述的类和控件。

我在我的asp.net项目DesignProject中添加了一个新类并粘贴了代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

namespace DesignProject
{
    public class DataPlaceHolder : PlaceHolder
    {
        protected override void DataBindChildren()
        {
            if (Visible)
            {
                base.DataBindChildren();
            }
        }
    }
}

如何在标记中使用控件DataPlaceHolder?我一直在尝试使用DesignProject:DataPlaceHolder ....但是未知的服务器标签'DesignProject:DataPlaceHolder'。

马丁

1 个答案:

答案 0 :(得分:1)

尝试:

<%@ Register TagPrefix="myControl" Namespace="DesignProject" Assembly="MyApp" %>