ASP.NET Custom Controls

后端 未结 4 2018
你的背包
你的背包 2021-01-15 04:56

How do you create a custom control (not an ASCX control) and, more importantly, use it in your project? I\'d prefer not to create a separate project for it or compile it as

4条回答
  •  离开以前
    2021-01-15 05:06

    Create the class for the control and build the solution. If everything goes well the control should now be available on the toolbox.

    Sometimes the VS doesn't update the toolbox. If that happens add the Register directive to the page:

    <%@ Register Assembly="NAME_OF_THE_ASSEMBLY" Namespace="NAMESPACE_OF_THE_CUSTOM_CONTROL" TagPrefix="cc1" %>
    

    then just use the control on the page:

    
    

提交回复
热议问题