How to customize the TagPrefix of the web server control instead of CC1

xiaoxiao2021-03-05  47

I have never paying attention to this problem, it is the ASP.NET server control written, that is, Web Custom Control. Drag the control to the page will have the following tag:

There is also such a syntax identity on the page header of the page.

<% @ Register tagprefix = "cc1" Namespace = "namespace" assembly = "assembly"%>

If the CC1 here is modified to the ideal tagname, then drag the control under the corresponding namespace, it will start with TAGNAME.

However, perhaps set in the web control code, you should not be so troublesome, and come back to the page to modify. That is to use the TagPRefix property (Attribute). As follows:

[Assembly: TagPrefix ("CustomControls", "Custom")] Namespace Custom Controls {// Simple Custom Control Public Class ExliStbox: Control {// ....}

CustomControls refers to a namespace, and Custom refers to the Tagname who wants to use.

Reference: MSDN TagPrefix Property

Link: http://www.ftponline.com/vsm/2003_08/magazine/columns/ASPNET/

转载请注明原文地址:https://www.9cbs.com/read-36689.html

New Post(0)