top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the use of @ Register directives?

+3 votes
439 views
What is the use of @ Register directives?
posted Feb 19, 2014 by Atul Mishra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

You use this when you want to use a user control in your aspx or ascx page declaratively. @Register
creates an association between a tag prefix and a custom control, which provides developers with a concise way to refer to custom controls in an ASP.NET application file (including Web pages, user controls, and master pages).

<%@ Register tagprefix="tagprefix"
   namespace="namespace"
   assembly="assembly" %>
<%@ Register tagprefix="tagprefix"
   namespace="namespace" %>
<%@ Register tagprefix="tagprefix"
   tagname="tagname"
   src="pathname" %>

assembly: The assembly in which the namespace associated with the tagprefix attribute resides.
namespace: The namespace of the custom control that is being registered.
src: The location (relative or absolute) of the declarative ASP.NET User Controls file to associate with the tagprefix:tagname pair.
tagname: An arbitrary alias to associate with a class. This attribute is only used for user controls.
tagprefix: An arbitrary alias that provides a shorthand reference to the namespace of the markup being used in the file that contains the directive.

answer Feb 19, 2014 by Meenal Mishra
...