Custom Control in ASP.NET C#

前端 未结 5 802
[愿得一人]
[愿得一人] 2021-02-04 12:47

I created a simple custom control that only inherits from the Literal control, and doesn\'t have any extensions yet, code is empty.

Namespace: CustomControl

5条回答
  •  名媛妹妹
    2021-02-04 13:01

    The problem lies in your <%@ Register TagPrefix="web" Namespace="CustomControls" %> tag: it misses the assembly name!

    It must become <%@ Register TagPrefix="web" Namespace="CustomControls" Assembly="YourAssemblyName" %>. If you have difficulties finding the assembly name for your class here are a few hints:

    1. If you created the class inside the web application's Visual Studio project, or in a separate DLL (shared library) project, then right-click the project and go to Properties to get the assembly name
    2. If you created the .cs file in App_Code directory, ASP.App_Code should work

    Otherwise please give us some information about project layout!

提交回复
热议问题