Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>CodeFileBaseClass</code>, <code>CodeFile</code>, <code>Inherits</code> work together with inheritance, not in place of inheritance.</p> <p>For example, specifying <code>CodeFile="page.aspx.cs"</code> without <code>page.aspx.cs</code> existing will result in: </p> <pre><code>Parser Error Message: The file '/page.aspx.cs' does not exist. </code></pre> <p>Assuming <code>page.aspx.cs</code> exists, specifying <code>CodeFileBaseClass="PageBase.cs"</code> without <code>PageBase.cs</code> existing will result in: </p> <pre><code>Parser Error Message: Could not load type 'PageBase.cs'. </code></pre> <p>On the other hand you may inherit from <code>PageBase</code> <strong>without</strong> specifying the <code>CodeFileBaseClass</code> attribute. This however could result in possible unexpected behaviour when referencing controls on the page from the base class.</p> <p>To quote from <a href="http://msdn.microsoft.com/en-us/library/ydy4x04a.aspx" rel="nofollow">Microsoft's @Page MSDN Documentation</a>: </p> <blockquote> <p><em><strong>CodeFileBaseClass</em></strong><br> <em>Specifies the type name of a base class for a page and its associated code-behind class. This attribute is optional, but when it is used the <strong>CodeFile</strong> attribute must also be present. Use this attribute when you want to implement a shared scenario, where you define common fields (and optionally, associated events) in a base class to reference the controls declared in a Web page. Because of the ASP.NET code generation model, if you defined the fields in a base class without using this attribute, at compile time new member definitions would be generated for the controls declared in the Web page (within a separate partial class stub), and your desired scenario would not work. But if you use the <strong>CodeFileBaseClass</strong> attribute to associate the base class with the page, and you make your partial class (its name is assigned to the <strong>Inherits</strong> attribute and its source file is referenced by the <strong>CodeFile</strong> attribute) inherit from the base class, then the fields in the base class will be able to reference the controls on the page after code generation.</em></p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload