Groups | Blog | Home
all groups > asp.net building controls > december 2004 >

asp.net building controls : TagPrefixAttribute Question


G Dean Blake
12/9/2004 5:03:03 PM
[quoted text, click to view]
a control using the namespace:

ESS.ServerControls

The book says that if I put the following in my control's AssemblyInfo.vb
file that my controls will be prefixed by an "ess" tagPrefix:

Imports System.Web.UI
..
..
<Assembly: TagPrefix("ESS.ServerControls", "ess")>

But it does not work. When my control gets dragged onto an aspx page, a
TagPrefix of "cc1" gets generated.

Anyone know what is wrong?
Thanks
G.

John Saunders
12/12/2004 11:14:05 AM
[quoted text, click to view]

I don't know if this is it, but the example from the MSDN documentation
(from VS2005 Beta 1) is:

Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

<assembly: TagPrefix("CustomControls", "custom")> _

Namespace CustomControls

' Simple custom control
Public Class MyVB_Control
Inherits Control
Private message As String = "Hello"

Public Property getMessage() As String
Get
Return message
End Get
Set (ByVal value As String)
message = value
End Set
End Property

<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand,
Name:="FullTrust")> _
Protected Overrides Sub Render(writer As HtmlTextWriter)
writer.Write(("<span style='background-color:aqua; font:8pt tahoma,
verdana;'> " + Me.getMessage + "<br>" + "VB version. The time on the server
is " + System.DateTime.Now.ToLongTimeString() + "</span>"))
End Sub 'Render
End Class 'MyControl
End Namespace 'CustomControls


John Saunders

G Dean Blake
12/12/2004 4:37:17 PM
The difference seems to be that those docs have me putting the TagPrefix
assembly directive in the source to the control itself instead of in the
AssemblyInfo file. I tried it and still got the same thing cc1.
[quoted text, click to view]

AddThis Social Bookmark Button