Can't get TagPrefix to work for custom Web control

G

Guest

Hi

I've created a new custom Web control. I have tried to customize the assembly attribute TagPrefix . However, each time I drag my custom control onto a form, it's TagPrefix is still "cc1". What am I missing here

My control is nested within two namespaces: for example, OuterNamespace and InnerNamespace. Taking that into account, the AssemblyInfo.cs of my custom control's solution contains the following additional lines

..
using System.Web.UI
..
[assembly: TagPrefix("OuterNamespace.InnerNamespace", "mas")
..

I build my custom control, add it to the VS Toolbox, and test it by dropping it on a form. Alas, instead of being prefixed by "mas", the control is still prefixed by "cc1". Any advice on this one

Thanks in advance
-Michael
 
B

Ben Miller [MSFT]

Michael,

I tested out both scenarios to make sure everything worked: I went to
http://msdn.microsoft.com/library/d...vbwlkWalkthroughCreatingCustomWebControls.asp
(watch the URL wrap) and followed the instructions for this so that I did
not miss anything, and I made things look like:

AssemblyInfo.cs

using System.Web.UI;
.....
[assembly: TagPrefix("CustomLabel", "mas")]


CustomLabel.cs

namespace CustomLabel
{
public class WebControlLibrary1 ....
}

and I did one with the namespace="CustomLabel.TestLabel" and [assembly:
TagPrefix("CustomLabel.TestLabel", "mas")] and everything works when I add
it to the toolbox and then drag it over to the IDE in VS.

Any more info that you could post like the @Register statement in the HTML
view of the IDE when you drag and drop it on the page?

HTH. Give me more info and I can see what else if available.

Ben Miller

--
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


Michael Skelton said:
Hi,

I've created a new custom Web control. I have tried to customize the
assembly attribute TagPrefix . However, each time I drag my custom control
onto a form, it's TagPrefix is still "cc1". What am I missing here?
My control is nested within two namespaces: for example, OuterNamespace
and InnerNamespace. Taking that into account, the AssemblyInfo.cs of my
custom control's solution contains the following additional lines:
...
using System.Web.UI;
...
[assembly: TagPrefix("OuterNamespace.InnerNamespace", "mas")]
...

I build my custom control, add it to the VS Toolbox, and test it by
dropping it on a form. Alas, instead of being prefixed by "mas", the control
is still prefixed by "cc1". Any advice on this one?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top