ASP.NET Register Directive

Defines page-specific (.aspx file) attributes used by the ASP.NET page parser and compiler.

Syntax

<%@ Register attribute="value" [attribute="value"...] %>

Register Directive Attributes

AttributesDescription
AssemblySpecifies the assembly you want to associating with the TagPrefix.
NamespaceSpecifies the namespace to relate with TagPrefix.
SrcSpecifies the user control.
TagNameSpecifies alias name to relate to your class name.
TagPrefixSpecifies alias name to relate to the namespace.

User Control Example

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CalendarUserControl.ascx.cs" 
Inherits="CalendarUserControl" Description="This is Calendar user control."%>
<asp:calendar id="Cal" runat="server" /%>

Example C#

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="homePage.aspx.cs" 
Inherits="homePage" %>
<%@ register tagprefix="uc1" tagname="CalendarUserControl" 
src="~/CalendarUserControl.ascx" %>  
<!DOCTYPE>
<html>
<head runat="server">
    <title>Calendar Page</title>
</head>
<body>
  <form id="form1" runat="server">
    <uc1:calendarusercontrol runat="server" />
  </form>
</body>
</html>  

Example VB

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="homePage.aspx.vb" 
Inherits="homePage" %>
<%@ register tagprefix="uc1" tagname="CalendarUserControl" 
src="~/CalendarUserControl.ascx" %>     
<!DOCTYPE>
<html>
<head runat="server">
    <title>Calendar Page</title>
</head>
<body>
  <form id="form1" runat="server">
    <uc1:calendarusercontrol runat="server" />
  </form>
</body>
</html>

More ASP.NET Directives

 
SHARE THIS IF YOU LIKE!
submit to reddit

SUBSCRIBE FOR LATEST UPDATES
HAVE WE CONNECTED ON FACEBOOK?
TOP TUTORIALSTOP CODE EXAMPLESTOP LIVE DEMOLINKSSTAY CONNECTED
HTML Tutorial
HTML5 Tutorial
Bootstrap3 Tutorial
Javascript Tutorial
TypeScript Tutorial
AngularJS Tutorial
CSharp Tutorial
PHP Tutorial
Developer Tools
Javascript
AngularJS
Google MAP API V3
ASP.NET
Javascript
AngularJS
Google MAP API V3
Contact Us
Advertise with Us
Privacy Policy
Disclaimer
Stay connected. We actually like you. If you want to get up to the minute updates, then connect with us on your fav below.
 
Twitter   Linkedin   Facebook   Google+    RSS   Pinterest
 
Protected by Copyscape Original Content Checker
 
 
Copyright ©2017 www.techstrikers.com Unauthorized reproduction/replication of any part of this site is prohibited.