----------------------------------------------------------- New Message on MumbaiUserGroup
----------------------------------------------------------- From: Swapnil_B1 Message 1 in Discussion New @ Page Directive Attributes ASP.NET 2.0 adds many new attributes to the @ Page directive. The following attributes are new in ASP.NET 2.0. Async - The Async attribute allows you to configure page to be executed asynchronously. AsyncTimeout - Specified the timeout for asynchronous pages. The default is 45 seconds. CodeFile - The CodeFile attribute is the replacement for the CodeBehind attribute in Visual Studio 2002/2003. CodeFileBaseClass - The CodeFileBaseClass attribute is used in cases where you want multiple pages to derive from a single base class. Because of the implementation of partial classes in ASP.NET, without this attribute, a base class that uses shared common fields to reference controls declared in an ASPX page would not work properly because ASP.NETs compilation engine will automatically create new members based on controls in the page. Therefore, if you want a common base class for two or more pages in ASP.NET, you will need to define specify your base class in the CodeFileBaseClass attribute and then derive each pages class from that base class. The CodeFile attribute is also required when this attribute is used. CompilationMode - This attribute allows you to set the CompilationMode property of the ASPX page. The CompilationMode property is an enumeration containing the values Always, Auto, and Never. The default is Always. The Auto setting will prevent ASP.NET from dynamically compiling the page if possible. Excluding pages from dynamic compilation increases performance. However, if a page that is excluded contains that code that must be compiled, an error will be thrown when the page is browsed. EnableEventValidation - This attribute specifies whether or not postback and callback events are validated. When this is enabled, arguments to postback or callback events are checked to ensure that they originated from the server control that originally rendered them. EnableTheming - This attribute specifies whether or not ASP.NET themes are used on a page. The default is false. LinePragmas - This attribute specifies whether line pragmas should be added during compilation. Line pragmas are options used by debuggers to mark specific sections of code. MaintainScrollPositionOnPostback - This attribute specifies whether or not JavaScript is injected into the page in order to maintain scroll position between postbacks. This attribute is false by default. When this attribute is true, ASP.NET will add a <script> block on postback that looks like this: <script src="/website/WebResource.axd?d=jBAvpwrdOM_V_Xzeox989A2 &t=632653133849531250" type="text/javascript"> </script> Note that the src for this script block is WebResource.axd. This resource is not a physical path. When this script is requested, ASP.NET dynamically builds the script. MasterPageFile - This attribute specifies the master page file for the current page. The path can be relative or absolute. StyleSheetTheme - This attribute allows you to override user-interface appearance properties defined by an ASP.NET 2.0 theme. Specifies the theme for the page. If a value is not specified for the StyleSheetTheme attribute, the Theme attribute overrides all styles applied to controls on the page. Title - Sets the title for the page. The value specified here will appear in the <title> element of the rendered page. ViewStateEncryptionMode - Sets the value for the ViewStateEncryptionMode enumeration. The available values are Always, Auto, and Never. The default value is Auto. When this attribute is set to a value of Auto, viewstate is encrypted is a control requests it by calling the RegisterRequiresViewStateEncryption method. Setting Public Property Values via the @ Page Directive Another new capability of the @ Page directive in ASP.NET 2.0 is the ability to set the initial value of public properties of a base class. Suppose, for example, that you have a public property called SomeText in your base class and youd like it to be initialized to Hello when a page is loaded. You can accomplish this by simply setting the value in the @ Page directive like so: [EMAIL PROTECTED] Language="C#" SomeText="Hello!" Inherits="PageBase" % The SomeText attribute of the @ Page directive sets the initial value of the SomeText property in the base class to Hello!. Swapnil (Swaps) http://swapsnet.spaces.live.com/ ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
