using TagPrefix to avoid having @ Register directives on pages using custom controls

S

Shan McArthur

Hello,

I am designing a custom control in a seperate DLL. I have used the
assembly:TagPrefix attribute in this project. The project is included as a
reference in our website project. I can use my custom control if I have a @
Register directive in my page, but I want to develop this control in a
manner that does not require this directive on each and every page in my
website (and other websites that use this control). Is there any way to
register the control so that this is not required? None of the .net
controls need this special directive.

Thanks,
Shan McArthur
 
S

Steven Cheng[MSFT]

Hi Shan,

Welcome to ASPNET newsgroup.
Regarding on the Registering Custom control prefix problem, based on my
research, I'm afraid this is limited by the currently ASP.NET page/control
parsing model. For those buildin controls ( with "ASP" prefix), they're
registered internally when parsing the Page and Controls. And there hasn't
provide any configuration elements for registering custom control in
web.config or machine.config. Currently we can only declare assembly
referencing in web.config / machine.config through the
compilation/assemblies element like:

<system.web>
..............
<compilation>
<assemblies>
<add assembly="ADODB"/>
<add assembly="*"/>
</assemblies>
</compilation>
</system.web>

which can replace the @ Assembly directive in aspx page.
But for @Register, currently we have to always declare it in aspx for our
custom controls.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
M

Michael Baltic

If you look at custom controls written by other companies, you will see that
they write out the @Register tag as well.

With the Infragistics components, if I drag a UltraWebGrid from the toolbox
onto my webform, the @Register tag is autogenerated for me. In addition, the
license file in my web project's root is updated.

If you have access to the source of a 3rd party control, or google, you
could probable find a way to automate this process for yourself as well.
 

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,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top