Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / February 2007

Tip: Looking for answers? Try searching our database.

Change the tag prefix of a custom control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shapper - 10 Oct 2006 18:59 GMT
Hello,

How can I change the tag prefix of a custom control.
My Asp.Net 2.0 custom control tag prefix is cc1.

Thanks,
Miguel
Teemu Keiski - 10 Oct 2006 19:07 GMT
Hi,

you can specify the prefix with @register directive on top of the page

< %@Register TagPrefix="myprefix" Namespace="System.MyControls"
Assembly="System.MyControls" % >

in ASP.NET 2.0, if you omit the Assembly attribute, control is looked from
App_Code

Signature

Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

> Hello,
>
[quoted text clipped - 3 lines]
> Thanks,
> Miguel
shapper - 11 Oct 2006 02:25 GMT
I think I am not understanding.
I created a few custom controls and I compiled my project to a dll
library.
When I drag one of my custom controls from the toolbox to an Aspx page
I get:
<cc1:MyCustomControl> ....

What I want is to change cc1 to something else.
I supose I need to do this inside my library code before I compile it.
I just don't know where.
I have a VB file for each custom control I create.

Thanks,
Miguel

> Hi,
>
[quoted text clipped - 19 lines]
> > Thanks,
> > Miguel
Teemu Keiski - 13 Oct 2006 21:42 GMT
The prefix is specified always on top of the aspx page on @Register
directive, since the control needs to be registered on the page. Despite
that its a custom control (or user control whatever, same thing applies),
and that's the prefix you use omn the page. cc1 is the default.

Signature

Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

>I think I am not understanding.
> I created a few custom controls and I compiled my project to a dll
[quoted text clipped - 35 lines]
>> > Thanks,
>> > Miguel
gerry - 16 Oct 2006 17:01 GMT
look at the attribute [assembly:TagPrefix()]

http://msdn2.microsoft.com/en-us/library/ms366537.aspx

> The prefix is specified always on top of the aspx page on @Register
> directive, since the control needs to be registered on the page. Despite
[quoted text clipped - 40 lines]
> >> > Thanks,
> >> > Miguel
intrader - 25 Feb 2007 17:16 GMT
> Hi,
>
[quoted text clipped - 5 lines]
> in ASP.NET 2.0, if you omit the Assembly attribute, control is looked from
> App_Code
intrader - 25 Feb 2007 17:23 GMT
> Hello,
>
[quoted text clipped - 3 lines]
> Thanks,
> Miguel

> Hello,
>
[quoted text clipped - 3 lines]
> Thanks,
> Miguel

There is assembly directive for the configuration file to change the
prefix like so (omit code):
<code>
       <add tagPrefix="aspSample"
         namespace="Samples.AspNet.CS.Controls">
       </add>
</code>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.