How To Use Reference tag in the page to refer to another page in Asp.Net 2.0

To refer another page in 2.0 we have to use the @reference tag in the page. We can use the tag to refer any page or class. In fact we can refer anything by giving the virtual path of the same. The @reference get the user control, Page or arbitrary file (given by virtual Path) to be dynamically compiled against the current Asp.Net file.

When we refer a page with the help of the @Reference tag, we can create the object of the page in the code behind. The basic syntax of the tag is simple.
<%@ Reference Page="~/Default.aspx" %>
The page has 3 attributes which are explained below. Page - The path to the external page that will be dynamically compiled with this page. Control – The path to the external user control that will be linked with the paged and dynamically compile and link to the current file. VirtualPath – The virtual path for the reference. This can be any file type as long as they have a build provider. This means that we can point to a master page here.

Post a Comment


Close Menu