Place Holder

This control can hold any control generated at run time. Example:

<%Page Language=”C#” AutoEventWireup=”true” CodeFile=“PlaceHolder.aspx.cs” Inherits=”PlaceHolder” %>

<script runat=”server”>

runat=”server”

The form tag includes a name and the code runat=”server” This little code line means that everything will be taken care of by the server.

@ Page Language=”C#”

This first segment lets the page know that the language in use is C# and not VB or some other language. It’s pretty self-explanatory.

AutoEventWireup=”true”

The AutoEventWireup Boolean indicates whether the ASP.NET pages are automatically connected to event-handling functions. With C#, the default is set to true, so the pages are connected to event-handling functions.

CodeFile=”Default.aspx.cs”

The final section indicates the name of the C# file and what it inherits.  Since the name of the ASP.NET design file is Default.aspx the CodeFile is Default.aspx.cs.

Inherits=”_Default” 

The Inherits attribute refers to the name of the class that the code inherits.

Read More

Web Form Life Cycle

The life cycle begins with a request for the page, which causes the server to load it. When the request is complete, the page is unloaded. The life cycle of a page is marked by the following events:

Initialize: Initialize is the first phase in the life cycle for any page or control. It is here that any settings needed for the duration of the incoming request are initialized.

Load ViewState: The ViewState property of the control is populated. The ViewState information comes from a hidden variable on the control, used to persist the state across round trips to the server. The input string from this hidden variable is parsed by the page framework, and the ViewState property is set. This can be modified via the LoadViewState( ) method: This allows ASP.NET to manage the state of your control across page loads so that each control is not reset to its default state each time the page is posted.

Process Post back Data: During this phase, the data sent to the server in the posting is processed. If any of this data results in a requirement to update the ViewState, that update is performed via the LoadPostData ( ) method.

Load: CreateChildControls ( ) is called, if necessary, to create and initialize server controls in the control tree. State is restored, and the form controls show client-side data. You can modify the load phase by handling the Load event with the OnLoad method.

Send Postback Change Modifications: If there are any state changes between the current state and the previous state, change events are raised via the  RaisePostDataChangedEvent( )  method.

Handle Postback Events: The client-side event that caused the postback is handled.

 PreRender: This is the phase just before the output is rendered to the browser. It is essentially your last chance to modify the output prior to rendering using the OnPreRender ( ) method.

Save State: Near the beginning of the life cycle, the persisted view state was loaded from the hidden variable. Now it is saved back to the hidden variable, persisting as a string object that will complete the round trip to the client. You can override this using the SaveViewState () method.

Render: This is where the output to be sent back to the client browser is generated. You can override it using the Render method. CreateChildControls ( ) is called, if necessary, to create and initialize server controls in the control tree.

Dispose: This is the last phase of the life cycle. It gives you an opportunity to do any final cleanup and release references to any expensive resources, such as database connections. You can modify it using the Dispose ( ) method.

Read More

Server

The node (computer) on network which provides services to the clients is known as server.

Web server examples

Java’s->Tomcat Apache, Wamp Server

Netscape’s ->Netscape

ASP-> IIS (Internet Information Services) (Inetpub (internet publishing) folder-wwwroot (is the default folder for IIS where stay all the ASP files to execute))

PHP-> Wamp and Xamp server

Read More

Types of scripting in ASP.Net

There are two types of scripting. Server side scripting and client (browser) side scripting.

Client side scripting is used to create and decorate pages which will display on browser.  It is browser dependent.

Example: Java Script and VB Scripting.

Server side scripting is used for operations (sending, receiving, calculating and storing data in database). All these operation are performed on server by asp and jsp and php.

Example:  ASP and JSP, PHP.

 Difference Between Client Side Scripting and Server Side Scripting

S.No.Client Side ScriptingServer Side Scripting
1.Script code is downloaded and executed at client side i.e pages will run on browser.The script is executed at the server End and the result is send to the client End.

2.Response to interaction is more immediate once the program code has been downloaded.

Complex process is more efficient as the program and associated resources are not downloaded to the browser.

3.Client are source as they do not have access to files and database. It is only for designing not for operations.

Have access to files and databases but have security considerations when sending sensitive information.

4.This scripting is browser dependent and behaves differently for every browser.

Does not depend on browser.

5.Affected by the processing speed of user’s computer.

Affected by the processing speed of the host server.
Read More