System.Web.UI Namespace Control Class
.NET Framework version 2.0
Sets or retrieves the application-relative virtual directory of the Page or UserControl object that contains this control.
Script |
Control.AppRelativeTemplateSourceDirectory [ = strVirtualDir ] |
This property can only be used programmatically; it cannot be set when declaring the control.
strVirtualDir |
The application-relative virtual directory of the page or user control that contains this control. |
The property is read/write with no default value.
The AppRelativeTemplateSourceDirectory property contains the application-relative path to the page or user control that contains the current control. For example, if the control is on a Web page that resides at
http://authors.aspalliance.com/sys
the AppRelativeTemplateSourceDirectory property returns "~/sys/
".
To return the virtual path, use the TemplateSourceDirectory property.
The following example shows the simplest way to retrieve and display the AppRelativeTemplateSourceDirectory for the first control on the current Web page.
<%= Page.Controls [ 0 ].AppRelativeTemplateSourceDirectory %>
And which, for this page, returns the following:
~/sys/
Control Members Page UserControl