Use of Register Directives in ASP.Net
Why we use @Register Directives in ASP.Net
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prabhu RajaPosted Oct 25, 2011, 3:55 AM
@Register directive informs the compiler of any custom server control added to the page.
Hemant KumarPosted Oct 25, 2011, 1:50 AM
Directives in ASP.NET are used to set attributes for a page. The @Register directive is a directive used to register user defined controls on a web page. A user created server control has an ascxextenstion. These controls inherit from the namespace System.Web.UI.UserControl. This namespace inherits from the System.Web.UI.Control.
A user control may be embedded in an aspx web page using the @Register directive. A user control cannot be executed on its own independently, but may be registered on a web page and then used out there. Below is the syntax for registering an @register directive in an aspx page in ASP.NET
<%@ Register TagPrefix="UC1" TagName="UserControl1" Src="UserControl1.ascx" %>
The TagPrefix attributes is used to specify a unique namespace for the user control. TheTagName is a name used to refer a user control uniquely by its name. Say we want to use this control in a webpage, we may use the code below...
Uma Shankar PatelPosted Oct 25, 2011, 1:47 AM
we use Register directive to register dll/custom controls with our application/website.