Welcome

Welcome to CMS n Web. Learn & Study completely Free Articles\Training about Web Designing\Development and CMS.

Search This Web

Friday, July 12, 2013

40 Useful HTML5 Tutorials, Techniques and Examples


HTML5 right after its arrival has been in the news because of its enhancedfunctionality and ease of use. And now the latest version of HTML5 is out, web developers and internet marketers are shifting to HTML5 as it comes with several new and improved features that distinctly make Web development easier.

In this collection, we are sharing some useful HTML5 tutorials with our designing and development fraternities to help them learn the new ways to get web pages SEO friendly and more interactive. In this post, we have collected some very valuable tutorials that will assist you in getting a good command of HTML5. Please feel free to share with us other useful tutorials that have kept you busy!
HTML5 Tutorials

Useful HTML5 Tutorials, Techniques and Examples

Create a Stylish Contact Form with HTML5 & CSS3
Follow this step by step process to create your own stylish contact form completely in HTML5 and CSS3. This tutorial uses a couple of the handy new features in HTML5 to add cool functionality to the form, while making use of cool CSS3 properties to recreate the Photoshop concept purely in code.
Create a Stylish Contact Form with HTML5 & CSS3
Create Vector Masks using the HTML5 Canvas
The HTML5 canvas can be used to create a lot of cool things, like games, video effects, graphs and more. It can also be used to produce some slightly less complex effects, like manipulating images on the page. In this post learn how to use the canvas tag and clipping to create images that aren’t so rectangular.
Create Vector Masks using the HTML5 Canvas
HTML5 File Uploads with jQuery
In this tutorial you will learn the development of a small web application called Upload Center, that will allow people to upload photos from their computers by dragging and dropping them onto the browser window, possible with the new HTML5 APIs exposed by modern browsers.
HTML5 File Uploads with jQuery
Making a Beautiful HTML5 Portfolio
This tutorial shows you how to create a beautiful HTML5 portfolio powered by jQuery and the Quicksand plugin. You can use it to showcase your latest work and it is fully customizable, so potentially you could expand it to do much more.
Making a Beautiful HTML5 Portfolio
Build a Custom HTML5 Video Player
This tutorial will show you how to build a custom HTML5 video player with Flash fallback support.
Build a Custom HTML5 Video Player
Create a Grid Based Web Design in HTML5 & CSS3
Follow this step by step walkthrough of the making of a sleek website design for an eyewear brand in HTML5 and CSS3. Build the HTML structure with the latest elements then style up the appearance of the site with CSS3 affects to match the original Photoshop concept with minimal use of background images.
Create a Grid Based Web Design in HTML5 & CSS3
Designing a Blog with HTML5
HTML5s feature set involves JavaScript APIs that make it easier to develop interactive web pages; learn how to mark up a blog.
Designing a Blog with HTML5
How to Build Cross-Browser HTML5 Forms
This tutorial looks at how to serve HTML5 forms to modern browsers, while compensating for older browsers by using a mix of Webforms2, Modernizr, jQuery UI and assorted jQuery Plugins.
How to Build Cross-Browser HTML5 Forms
Implementing HTML5 Drag and Drop
One of the new features in HTML5 is native drag and drop. In this tutorial and screencast, you’ll discover how to implement native drag and drop to build a simple shopping cart interface.
Implementing HTML5 Drag and Drop
Coding a CSS3 & HTML5 One-Page Website Template
Make an HTML5 web template, using some of the new features brought to you by CSS3 and jQuery, with the scrollTo plug-in.
Coding a CSS3 & HTML5 One-Page Website Template
HTML5 and CSS3 Without Guilt
Not every HTML5 or CSS3 feature has widespread browser support, naturally. To compensate for this, enterprising developers have created a number of tools to let you use these technologies today, without leaving behind users who still live in the stone age.
HTML5 and CSS3 Without Guilt
How to Make an HTML5 iPhone App
In this tutorial you will learn how to create an offline HTML5 iPhone application.
How to Make an HTML5 iPhone App
Design & Code a Cool iPhone App Website in HTML5
HTML5 is definitely the flavor of the month, with everyone in the design community getting excited about its release. In this tutorial you’ll get a taste of what’s to come by building a cool iPhone app website using an HTML5 structure, and visual styling with some CSS3 effects.
Design & Code a Cool iPhone App Website in HTML5
Have a Field Day with HTML5 Forms
Learn how to style a beautiful HTML5 form using some advanced CSS and latest CSS3 techniques.
Have a Field Day with HTML5 Forms
HTML 5 and CSS 3: The Techniques You’ll Soon Be Using
In this tutorial you will learn how to build a blog page using next-generation techniques from HTML5 and CSS3.
HTML5 and CSS3: The Techniques You'll Soon be Using
HTML5 Canvas Element Guide
In this guide get started on understanding the canvas element and what kinds of things are required and expected in its associated code.
HTML5 Canvas Element Guide
Bouncing a Ball Around with HTML5 and JavaScript
This guide will explore the use of HTML5s canvas element through a fun example by creating a bouncing blue ball.
Bouncing a Ball Around with HTML5 and JavaScript
Blowing up HTML5 video and mapping it into 3D space
This tutorial is about a blowing up HTML5 video and mapping it into 3D space. Check it out.
Blowing up HTML5 video and mapping it into 3D space
Comprehensive video tutorial on HTML5
This is a video put up by a Google Employee called ‘Brad Neuberg’ to provide us with an educational introduction to HTML5. This is for the people who don’t find time to keep up with HTML5 developments by reading articles.
Comprehensive video tutorial on HTML5
Another HTML5 Tutorial from Brad Neuberg
Brad Neuberg explains why HTML5 matters – to consumers as well as developers! He also shares the practical implications of the changes that are coming along with HTML5 support in modern browsers.
Another HTMLs Tutorial from Brad Neuberg
Code a Backwards Compatible, One Page Portfolio with HTML5 and CSS3
HTML5 is the future of Web development but believe it or not you can start using it TODAY. It introduces meaningful tags for common elements such as navigations and footers which makes much more sense and are more natural.
Code a Backwards Compatible, One Page Portfolio with HTML5 and CSS3
Creating an ad in HTML5
HTML5 is an evolving standard competing with Flash for next generation web technologies. One of the prominent uses of Flash is animated and interactive advertisements. Read here to find out more.
Creating an Ad in HTML5
Code a Vibrant Professional Web Design with HTML5/CSS3
In this Web design tutorial, convert a vibrant and professional design with the help of HTML5 and CSS3.
Code a Vibrant Professional Web Design with HTML5/CSS3
Simple Website Layout Tutorial Using HTML 5 and CSS 3
This tutorial walks you through making a very very Simple web page with HTML5 and styling with CSS3.
Simple Website Layout Tutorial Using HTML5 and CSS3
How to Draw with HTML 5 Canvas
Among the set of goodies in the HTML5 specification is Canvas, which is a way to programmatically draw using JavaScript.
How to Draw with HTML5 Canvas
The video element
The video element is brand new in HTML5 and allows you to play a movie within your website! The data of this element is supposed to be video but it might also have audio or images associated with it.
The video element
Building a live news blogging system in php. Spiced with HTML5, CSS3 and jQuery
With this tutorial you will be building a live news blogging system in PHP.
Building a live news blogging system in php, Spiced with HTML5, CSS3 and jQuery
Combining Modern CSS3 and HTML5 Techniques
Just because some techniques don’t work in decade old browsers doesn’t mean that you shouldn’t be learning everything you can! Stay on the cutting edge, as we use everything from CSS shadows and animations, to HTML5 mark-up and local storage, to utilizing jQuery to work with the Picasa API.
Combining Modern CSS3 and HTML5 Techniques
webOS HTML5 Database Storage Tutorial
If you haven’t been able to find any tutorials on HTML5s storage capability, you’re not alone. Here’s the first webOS / HTML5 database storage tutorial.
webOS HTML5 Database Storage Tutorial
The Official Guide to HTML5 Boilerplate
In this screencast, Paul Irish meticulously reviews each page, and then further goes on to explain why and when you would use each snippet in your projects.
The Official Guide to HTML5 Boilerplate
How To Create a Cute Popup Bar With HTML5, CSS3 and jQuery
Here you will learn how to create a bar that pops up at the top of a page, and stays above the content (similar to ‘hellobar’). This has only been tested in Chrome and Safari and may not work in other browsers.
How to Create a Cute Popup Bar
An HTML5 Slideshow with Canvas & jQuery
All uses of canvas you’ve come across so far are probably limited to games and other proof of concept demos. This tutorial will show you how to create a progressively enhanced slideshow with a fancy transitioning effect, which is perfectly functional in older browsers as well.
An HTML5 Slideshow with Canvas & jQuery
Designing Search Boxes with HTML5 and CSS3
Search is one of the most important parts of any website. Learn a few practical techniques for designing search forms and a few tricks to build usable and good-looking search functionality.
Designing Search Boxes with HTML5 and CSS3
Rethinking Forms in HTML5
While there are many changes for the better in the HTML5 specification, there is no better bang for the buck for the data driven website than the transformation of forms. These simple changes will transform how you enter, validate, process, and even display inputs. You will be able to create more usable web applications with less code and less confusion.
Rethinking Forms in HTML5
HTML 5 Tutorial for Web Developers: The Video Element
If you are already familiar with HTML, you will be ready to jump into HTML5 without much of a learning curve. In the W3C's document, each of the HTML5 elements are discussed, including the often discussed video element, which you can learn all about here.
HTML5 Tutorial for Web Developers: The Video Element
HTML5 Geolocation Tutorial
In this tutorial you will learn the geolocation capabilities of HTML5 and the basic principles needed to take advantage of them in your next HTML5 app.
HTML5 Geolocation Tutorial
How to Make All Browsers Render HTML5 Correctly — Even IE6!
In this tutorial, create a common layout using some of HTML5s new semantic elements, then use JavaScript and CSS to make our design backwards-compatible with Internet Explorer. Yes, even IE6.
How to Make All Browsers Render HTML5 Correctly
Coding Up a Web Design Concept into HTML & CSS
This tutorial walks you through the process of converting the design concept from PSD document right through to completed HTML and CSS mockup, complete with clean and valid code, a few touches of CSS3 and some quick fixes to help out old IE6.
Coding Up a Web Design Concept in HTML & CSS
Creating an Animated 404 Page
In this tutorial learn to create an animated 404 page, which you can easily customize and improve.
Creating an Animated 404 Page
HTML5 Visual Cheat Sheet
HTML5 Visual Cheat Sheet is a useful cheat sheet for web designers and developers. This cheat sheet is essentially a simple visual grid with a list of all HTML tags and of their related attributes supported by HTML versions 4.01 and/or 5.
HTML5 Visual Cheat Sheet
HTML5 Canvas Experiment
Time for us to play with this technology. We’ve created a little experiment which loads 100 tweets related to HTML5 and displays them using a javascript-based particle engine. Each particle represents a tweet – click on one of them and it’ll appear on the screen.
HTML5 Canvas Experiment

Conclusion

Do share with us what you think about this post. Which of these tutorials you find the most useful and helpful for your work? Also leave a comment letting us know if we have missed any good resources out there.

How to Make an HTML5 iPhone App

How to Make an HTML5 iPhone App
You’ve been depressed for like a year now, I know. All the hardcore Objective-C developers have been having a hay-day writing apps for the iPhone. You might have even tried reading a tutorial or two about developing for the iPhone, but its C—or a form of it—and it’s really hard to learn.
I don’t want to say that you should give up on the objective: you can get it eventually. But in the meantime, there is something else that you can do.
You can create a native app that lives with all the other apps, and for the most part, it’s going to be a pitch-perfect imitation.
You can do this with the skill set you probably already have: HTML(5), CSS, and JavaScript.
I’ll show you how to create an offline HTML5 iPhone application. More specifically, I’ll walk you through the process of building a Tetris game.

Offline?

What am I talking about when I say "offline"? Well, it means that we have a custom icon, a custom startup screen, a native look-and-feel, and you can use the app even when the phone isn’t connected to the Internet.
The app should be as functional as it can when it is offline, just like normal native mobile apps.
This is a tutorial specifically for iPhones but most of these techniques apply to all phones that have HTML5-capable browsers.
Yeah, I mean it, check out the following image. It has no URL bar and no navigation at the bottom. It looks just like a native mobile application.
Final result

Prework

You are going to need access to a server where you can change the HTTP Headers on your files. This is because we need to take advantage of HTML5′s offline caching (more on this later down the page).
Apache does this really well and you can just add something to a .htaccess file and it will just work. Here’s a tutorial on modifying HTTP headers using htaccess.
The other thing you need to do is to enable the debug bar in Safari’s web browser on your iPhone unit. Go to the Settings.app > Safari > Developer on your iPhone, then turn on the debug console. This will help you spot potential JavaScript errors.
Once you’ve built your app, you should turn this off so that you will get the full experience when testing your HTML5 iPhone app.
Prework

About the App

Icon and Startup Screen

The icon needs to be 57px x 57px.
The iPhone will round the corners of your icon, create a dropshadow, and add a shine to whatever icon you use.
It should be in PNG or JPG format.
Here is what I used for the tetris game.
Icon and Startup Screen
The startup screen needs to be 320px x 460px and should also be in PNG or JPG format.
Here is what I used for the startup screen.
Icon and Startup Screen

Some tips before you start

Stay small, sparse and simple.
  • Small: This is mobile app development so even though you are caching your stuff, it’s still a smart idea to keep your file sizes lean.
  • Sparse: You should try to keep the amount of files you deal with as low as possible.
  • Simple: Start with a few simple ideas and execute it. By keeping your scope small, you can get things done faster.

Application Cache

This is a new standard, you can read the spec here.
Application caching allows browsers to determine in advance all the files a web page will need for the web page to work.
It will cache those files (to a fault, sometimes). The syntax of this file is simple: just list the locations of your files in either absolute (e.g.http://yourwebserver.com/picture.png) or relative to the manifest file (/picture.png). The browser will keep those files offline.
You can also list a few URLs that should not be cached, but this isn’t pertinent for our offline app (if you’re interested, read about this in the documentation).
One tricky part to this whole thing is that the manifest (the list of files that need to be cached offline) has to be passed with a filetype Header set to text/manifest. That is why you need access to a web server that can set HTTP headers.

Screen Size

A quick note when designing your application: When you are in app mode, you have a screen size of 320px x 460px. When you are in web mode, it has a screen size of 320px x 356px. This can affect the user interface of your offline HTML5 app.
Here you can see the difference side by side.
Screen Size

HTML

It’s a real browser so your HTML is exactly the same. The iPhone browser is also in the forefront of HTML5, so dig into the spec.
For more in-depth detail, check out the Safari Developer’s corner:

Let’s get coding

The app starts by defining your markup. here is the markup for my Tetris app.
<!DOCTYPE html>
<html manifest="tetris.manifest">
<head>

    <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
    <meta name="apple-mobile-web-app-capable" content="yes" />

    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <link rel="apple-touch-icon" href="iphon_tetris_icon.png"/>

    <link rel="apple-touch-startup-image" href="startup.png" />
    <link rel="stylesheet" href="tetris.css" type="text/css" media="screen, mobile" title="main" charset="utf-8">

    <title>offline Tetris</title>
</head>
<body>
   <!-- Put your Markup Here -->
   <script type="text/javascript" src="tetris.js"></script>

</body>
</html>
First, notice the Doctype. Isn’t HTML5 awesome?
The manifest="cache.manifest" property on the <html> tag is how the browser knows that we want to cache this web page offline.
There’s proprietary Apple markup on our HTML5 page. A brief explanation of each:
  • apple-mobile-web-app-capable: This is another tip-off that we want to be an offline app.
  • apple-mobile-web-app-status-bar-style: This hides the status bar, and nav bar when the app is offline.
  • apple-touch-icon:This is the pointer to the image that want to be the icon.
  • apple-touch-startup-image: This is a url pointing to the startup image.
Also note that you should put CSS at the top and JavaScript at the bottom (best practices still apply here).

CSS

It’s almost the same as a normal web page. There are some specific -webkit CSS rules that you can use that do some really cool things like animation, but this is a quick-and-dirty guide and that’s outside of the scope of this article.
The CSS is just Plain Jane.
body {
    overflow:hidden; 
    background: #d7d7d7;
    margin:0;
    padding:0;
}
#tetris {
    width: 320px;
    height: 460px;
    background:#000;
}
The style is really just to the div element on our web page to make sure it fits in the iPhone’s viewport properly.

JavaScript

I used a modded version of a JavaScript from Dalton Ridenhour; I found it on Github. The JS was written originally for a normal web browser. The only modifications I had to make was to support not having a keyboard.
In general, JS functions work just fine on the iPhone—there are exceptions though. Think about something like a mouseover, the event exists on the iPhone, but I am not sure how helpful it is when you don’t have a standard pointing device (such as a mouse). Quirksmode posted an article about events on the iPhone that is really helpful.
When you have all of that, you can test it out but opening your index.html in an iPhone, and you should be able to see everything work.
Then, next step is to server it from an actual webserver that can set the proper settings on the cache.manifest.
Then you could be able to add it to the home screen and have all the extras, and see the offline mode.
You can see a working version I have set up at:

Bonus Section: Offline Data

Along with the ability to keep files that are needed offline, you can also store user data in an offline database. There are two major APIs for per user and/or per page data. The first is localStorage. localStorage, is an easy to use key-value store with a dead simple API.
localStorage.dataToStore = 5;
console.log(localStorage.dataToStore); // 5 
You can use this for storing the user’s score, for example.
The second is actually an offline SQL engine, a webdatabase. The APIs are a little more advanced. Here is a little of you will see.
// Try and get a database object
var db;

try {
    if (window.openDatabase) {
        db = openDatabase("NoteTest", "1.0", "HTML5 Database API example", 200000);
        if (!db)
            alert("Failed to open the database on disk.  This is probably because the version was /
            bad or there is not enough space left in this domain's quota");
    } else
        alert("Couldn't open the database.  Please try with a WebKit nightly with this feature enabled");
} catch(err) { }

// Check and see if you need to initalize the DB
db.transaction(function(tx) {
    tx.executeSql("SELECT COUNT(*) FROM WebkitStickyNotes", [], function(result) {
        loadNotes();
    }, function(tx, error) {
        tx.executeSql("CREATE TABLE WebKitStickyNotes (id REAL UNIQUE, note TEXT, timestamp /
        REAL, left TEXT, top TEXT, zindex REAL)", [], function(result) { 
            loadNotes(); 
        });
    });
});

// Insert a test Note. 
var note = {
    id: "1",
    text:" This is a test note",
    timestamp: "112123000",
    left:10,
    top:10,
    zIndex:2
};
db.transaction(function (tx) 
{
    tx.executeSql("INSERT INTO WebKitStickyNotes (id, note, timestamp, left, top, zindex) VALUES /
    (?, ?, ?, ?, ?, ?)", [note.id, note.text, note.timestamp, note.left, note.top, note.zIndex]);
}); 

// Get all the notes out of the database.
db.transaction(function(tx) {
    tx.executeSql("SELECT id, note, timestamp, left, top, zindex /
    FROM WebKitStickyNotes", [], function(tx, result) {
        for (var i = 0; i < result.rows.length; ++i) {
            var row = result.rows.item(i);
            var note = new Note();
            note.id = row['id'];
            note.text = row['note'];
            note.timestamp = row['timestamp'];
            note.left = row['left'];
            note.top = row['top'];
            note.zIndex = row['zindex'];

            if (row['id'] > highestId)
                highestId = row['id'];
            if (row['zindex'] > highestZ)
                highestZ = row['zindex'];
        }

        if (!result.rows.length)
            newNote();
    }, function(tx, error) {
        alert('Failed to retrieve notes from database - ' + error.message);
        return;
    });
});

Wrap Up

There is lot that can be done with offline HTML apps. Games, like tetris, are even possible, but you would probably want to consider what you want to do and make sure its right for an offline app. Quake 3 Arena, probably not. A to-do list app, definitely.
Let thousands apps bloom!

Wednesday, July 10, 2013

SQL Membership Provider and aspnet_regsql.exe Utility

The aspnet_regsql.exe runs the ASP.NET SQL Server Setup Wizard which allows you to create or configure a SQL Server database to store information for membership, profiles, role management, personalization, and SQL Web event provider. Once created, you may use forms authentication and the login controls to access these tables.

In the Microsoft.NET/Framework/... directory as shown below, find the aspnet_regsql.exe.
Execute the aspnet_regsql.exe file to begin the ASP.NET SQL Server Setup Wizard to create the SQL Server database or add tables to an existing database:
Select to Configure SQL Server for application services:
Select a Server name for Windows authentication and then select an existing database name or use the default. Choosing the default will name the database "aspnetdb."
If you want to use an existing database, simply select the database:
The wizard will now summarize, run and create the database.
After completion, you may use the Database Explorer to view your tables:
When done creating the database, you would setup your web config file with the connection string to the aspnetdb.mdf. You would also make sure your authentication mode is set to forms: authentication mode="Forms" (see below).
Once you've completed the connection string, you will want to setup a user in your tables. To do this, you may use the ASP.NET Configuration under the Website menu item.
You may use the Security tab to add and edit users.
Select the Create User link to create a user. Select the "Administrators" checkbox if you wish this to be an administrative account. Once your Admin account is created, others may use the CreateUserWizard in your application in order to create accounts.
To add Log in and User Creation to your website, use the Login Controls.
Using the Login and CreateUserWizard controls will automatically create the code and forms as shown below:
Log In
Sign Up for Your New Account



ref: by Nannette Thacker - September 1, 2007

Monday, July 8, 2013

ASP.Net life cycle

ASP.Net life cycle specifies, how:
  • ASP.Net processes pages to produce dynamic output
  • The application and its pages are instantiated and processed
  • ASP.Net compiles the pages dynamically
The ASP.Net life cycle could be divided into two groups:
  1. Application Life Cycle
  2. Page Life Cycle

ASP.Net Application Life Cycle:

The application life cycle has the following stages:
  • User makes a request for accessing application resource, a page. Browser sends this request to the web server.
  • A unified pipeline receives the first request and the following events take place:
    • An object of the ApplicationManager class is created.
    • An object of the HostingEnvironment class is created to provide information regarding the resources.
    • Top level items in the application are compiled.
  • Response objects are created . the application objects: HttpContext, HttpRequest and HttpResponse are created and initialized.
  • An instance of the HttpApplication object is created and assigned to the request. The request is processed by the HttpApplication class. Different events are raised by this class for processing the request.

ASP.Net Page Life Cycle:

When a page is requested, it is loaded into the server memory, processed and sent to the browser. Then it is unloaded from the memory. At each of this steps, methods and events are available, which could be overridden according to the need of the application. In other words, you can write your own code to override the default code.
The Page class creates a hierarchical tree of all the controls on the page. All the components on the page, except the directives are part of this control tree. You can see the control tree by adding trace= "true" to the Page directive. We will cover page directives and tracing under 'directives' and 'error handling'.
The page life cycle phases are:
  • Initialization
  • Instantiation of the controls on the page
  • Restoration and maintenance of the state
  • Execution of the event handler codes
  • Page rendering
Understanding the page cycle helps in writing codes for making some specific thing happen at any stage of the page life cycle. It also helps in writing custom controls and initializing them at right time, populate their properties with view-state data and run control behavior code.
Following are the different stages of an ASP.Net page:
  • Page request . when ASP.Net gets a page request, it decides whether to parse and compile the page or there would be a cached version of the page; accordingly the response is sent
  • Starting of page life cycle . at this stage, the Request and Response objects are set. If the request is an old request or post back, the IsPostBack property of the page is set to true. The UICulture property of the page is also set.
  • Page initialization . at this stage, the controls on the page are assigned unique ID by setting the UniqueID property and themes are applied. For a new request postback data is loaded and the control properties are restored to the view-state values.
  • Page load . at this stage, control properties are set using the view state and control state values.
  • Validation . Validate method of the validation control is called and if it runs successfully, the IsValid property of the page is set to true.
  • Postback event handling . if the request is a postback (old request), the related event handler is called.
  • Page rendering . at this stage, view state for the page and all controls are saved. The page calls the Render method for each control and the output of rendering is written to the OutputStream class of the Page's Response property.
  • Unload . the rendered page is sent to the client and page properties, such as Response and Request are unloaded and all cleanup done.

ASP.Net Page Life Cycle Events:

At each stage of the page life cycle, the page raises some events, which could be coded. An event handler is basically a function or subroutine, bound to the event, using declarative attributes like Onclick or handle.
Following are the page life cycle events:
  • PreInit . PreInit is the first event in page life cycle. It checks the IsPostBack property and determines whether the page is a postback. It sets the themes and master pages, creates dynamic controls and gets and sets profile property values. This event can be handled by overloading the OnPreInit method or creating a Page_PreInit handler.
  • Init . Init event initializes the control property and the control tree is built. This event can be handled by overloading the OnInit method or creating a Page_Init handler.
  • InitComplete . InitComplete event allows tracking of view state. All the controls turn on view-state tracking.
  • LoadViewState . LoadViewState event allows loading view state information into the controls.
  • LoadPostData . during this phase, the contents of all the input fields defined with the <form> tag are processed.
  • PreLoad . PreLoad occurs before the post back data is loaded in the controls. This event can be handled by overloading the OnPreLoad method or creating a Page_PreLoad handler.
  • Load . the Load event is raised for the page first and then recursively for all child controls. The controls in the control tree are created. This event can be handled by overloading the OnLoad method or creating a Page_Load handler.
  • LoadComplete . the loading process is completed, control event handlers are run and page validation takes place. This event can be handled by overloading the OnLoadComplete method or creating a Page_LoadComplete handler.
  • PreRender . the PreRender event occurs just before the output is rendered. By handling this event, pages and controls can perform any updates before the output is rendered.
  • PreRenderComplete . as the PreRender event is recursively fired for all child controls, this event ensures the completion of the pre-rendering phase.
  • SaveStateComplete . state of control on the page is saved. Personalization, control state and view state information is saved. The HTML markup is generated. This stage can be handled by overriding the Render method or creating a Page_Render handler.
  • UnLoad . the UnLoad phase is the last phase of the page life cycle. It raises the UnLoad event for all controls recursively and lastly for the page itself. Final cleanup is done and all resources and references, such as database connections, are freed. This event can be handled by modifying the OnUnLoad method or creating a Page_UnLoad handler.

How to Pass Variable b/w Pages Using QueryString in ASP.net with C#

Intro:

Often you need to pass variable content between your html pages or aspx webforms in context of Asp.Net. For example in first page you collect information about your client, her name and last name and use this information in your second page.
For passing variables content between pages ASP.NET gives us several choices. One choice is usingQueryString property of Request Object. When surfing internet you should have seen weird internet address such as one below.
http://www.localhost.com/Webform2.aspx?name=Faizan&Age=23
This html addresses use QueryString property to pass values between pages. In this address you send 3 information.
  1. Webform2.aspx this is the page your browser will go.
  2. name=Faizan you send a name variable which is set to Atilla
  3. Age=23 you send a lastName variable which is set to Ozgur
As you have guessed ? starts your QueryString, and & is used between variables. Building such a query string in Asp.Net is very easy. Our first form will have 2 textboxes and one submit button.
Put this code to your submit button event handler.
private void btnSubmit_Click(object sender, System.EventArgs e)
{
Response.Redirect("Webform2.aspx?Name=" +
this.txtName.Text + "&Age=" +
this.txtAge.Text);
} 
Our first code part builds a query string for your application and send contents of your textboxes to second page. Now how to retrieve this values from second page. Put this code to second page page_load.
private void Page_Load(object sender, System.EventArgs e)
{
this.txtBox1.Text = Request.QueryString["Name"];
this.txtBox2.Text = Request.QueryString["Age"];
} 
Request.QueryString is overloaded with a second way. You can also retrieve this values using their position in the querystring. There is a little trick here. If your QueryString is not properly built Asp.Net will give error.
private void Page_Load(object sender, 

System.EventArgs e)
{
this.txtBox1.Text = Request.QueryString[0];
this.txtBox2.Text = Request.QueryString[1];
}
Some other ways to reach contents of QueryString.
foreach( string s in Request.QueryString)
{
Response.Write(Request.QueryString[s]);
}
Or 
for (int i =0;i < Request.QueryString.Count;i++)
{
Response.Write(Request.QueryString[i]);
} 
Advantages of this approach
  1. It is very easy.
Disadvantages of this approach
  1. QueryString have a max length, If you have to send a lot information this approach does not work.
  2. QueryString is visible in your address part of your browser so you should not use it with sensitive information.
  3. QueryString can not be used to send & and space characters.
If you write this code and try them you will see that you have a problems with space and & characters, e.g. if you need to send a variable which contains & such as "Mark & Spencer". There must be a solution for this problem. If you look to Google’s query string you will see that it contains a lot of %20. This is the solution of our third disadvantage. Replace space with %20 and & with %26 for example.
private void btnSubmit_Click(object sender, System.EventArgs e)
{
string p1 = this.txtName.Text.Replace("&","%26");
p1 = this.txtName.Text.Replace(" ","%20");
string p2 = this.txtLastName.Text.Replace("&","%26");
p2 = this.txtName.Text.Replace(" ","%20"); 
            "WebForm2.aspx?" + 
            "Name=" + p1 + 
            "&LastName=" + p2;
Response.Redirect(p2);
} 
Since this is a such a common problem Asp.Net should have some way to solve. There it isServer.UrlEncode. Server.UrlEncode method changes your query strings to so that they will not create problems.
 private void btnSubmit_Click(object sender, System.EventArgs e)
{
Response.Redirect("WebForm2.Aspx?" + 
"Name=" +   Server.UrlEncode(this.txtName.Text) + 
"&LastName=" + Server.UrlEncode(this.txtLastName.Text)); 
}