| |||||||||||
@ ReferenceASP.NET Syntax ASP.NET Page Syntax Page Directives Declaratively indicates that another user control or page source file should be dynamically compiled and linked against the page in which this directive is declared. <%@ Reference page | control = "pathtofile" %> Attributes
RemarksUsing this directive allows you to dynamically compile a page or user control and add it to the ControlCollection object, accessed through the Controls property, for the page or server control. This allows you to cast the returned type after you have called the LoadControl method ( inherited by the page from the TemplateControl class ). Syntax ExampleThe below code snippet demonstrates using this directive to link a user control, MyControl.ascx, and load it to a containing page using the LoadControl method. When it is loaded to the page, the user control's MyProperty value is set, and the user control is added to a PlaceHolder server control's ControlCollection object through the Controls property.
See AlsoWeb Forms User Controls Introduction to Web Forms |
| ||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme