Thursday, July 21, 2005

Page directive

The page directive in the code behind version contains the attribute to corresponding source code file over attribute CompileWith="xxxx" and the class in the source code attribute="xxxx"

<@% Page CompileWith="YourPage.aspx.cs" ClassName="YourClassName"%>

Notice that the new class is a partial class which doesn't contains all information
you were used to it in version 1.x.

partial classes derives from System.Web.UI.Page.

Sample:

using System;
using System.Web;

.....


public partial class YourWebSite_aspx
{
void foo()
{
// your stuff goes here.....
}
}

the following link describes you this and some additional new features:

http://www.c-sharpcorner.com/Code/2004/July/WhidbeyFeatures.asp


If you wonder how the whole construct works you can do a research about
"Dynamic Page Compilation".

No comments:

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge