| 0 comments ]

You can now follow the same way like in the blogger help to create your expandable post. When writing your new post, anything you put above the tag will be the teaser text.

The main body of your post needs to go in between the and tags. When you have finish typing your post, make sure you add "more" label in order for the “read more” link to work properly.

| 0 comments ]

ASP.NET directives are special instructions to CLR about the behaviour and operations of the webforms.Every ASP.NET page contains directives.In other words,these directives are commands that the compiler uses when the page is compiled.We can control the behaviour of page by using directives.It doesn't matter that the page uses code-behind model or the inline-coding model,we can use directives in our application.

Directive is opened with .The format of a directive is as follows :
<%@[Directive] Attribute=value %>

we can add more than one attribute to directive statements as follows:
<%@[Directive] Attribute=value Attribute=value %>

There are 11 directives in ASP.NET 2.0.

Page - when the page is complied the @Page directive enables us to use attributesand values for an .aspx page.
Control - Enable us to use with user controls(.ascx).
Register - Registers one .ascx file to web-page[.aspx].
OutputCache - Used for Client-side caching.
Import - Imports a Namespace[Package] into the page.
Implements - Implements one Interface to web-form[.aspx/.ascx].
Reference - Used for Page To Page Data Transfer.
Assembly - Includes one Assembly[.dll] to the application.
PreviousPagetype - Enables the page in an application to work with postback from other Page.Master - Defines one Master[.master] Page.MasterType - Uses a class name to a page within specified master page.
Tips:
(1.)Although page still compiles if we put these directives at a different place in the page but it is good programming practice to put these directives at the top of our page or control.
(2.)@Page and @Control directives can not be used at the same time in .aspx page.

| 0 comments ]

Introduction:
This tutorial illustrates how to Implement Fragment Caching, this caching is conceptually same as Page caching. Here we will create a User Control file [.ascx] which will show System Date & Time in a Label control and embed it in a aspx.page that will also show system's Current Date & Time.
We will use Directive in the User control file and Directive in our Main Page to embed User Control file below Directive.
Same as earlier we have done in Page Cache we have to declare it's Duration attribute, when you request the Main Page label in Main page gets updated but the Label in User Control file is cached hence it will show the cached time (assuming that the duration of User Control file has not elapsed).
Step 1:
Create a Website name it Caching and rename the Default.aspx file to FragmentCache.aspx
Step 2:
Drag & Drop Label control on the Page with properties [ID= LblMsg ]

Step 3:
Write this code in FragmentCache.aspx.cs File.
protected void Page_Load(object sender, EventArgs e) { LblMsg.Text = "Current Time : "; LblMsg.Text += DateTime.Now.ToString(); }
The above code is for Main Page which will show system current Date & Time.
Step 4:
Now add a new Web User Control file in this project and name it UCPage.ascx
Step 5:
Again Drag & Drop Label control on the UCPage.ascx with properties [ID= LblMsg ]

Step 6:
Write this Line of code under Directive in PageCache.aspx File.

The above code will make this file cached for 10 secs.
Step 7:
Now Write This Line of Code in UCPage.ascx.cs File
protected void Page_Load(object sender, EventArgs e) { LblMsg.Text = "Cached Time : "; LblMsg.Text += DateTime.Now.ToString(); }
Step 8:
Now Drag & drop UCPage.acsx File from solution explorer on FragmentCache.aspx file by doing this, automatically these line of code are added in FragmentCache.aspx file.

When you debug FragmentCache.aspx page you will see that the page shows the current time in upper Label control while lower Label Control shows Cached time. Whether how many time you have refresh the page within 10 secs in will show same time, as soon as the time elapsed you will get the current system time in both Controls. This is how we implement Fragment cache in asp.net