Posts

ASP.NET - HTML Server

Image
The HTML server controls are basically the standard HTML controls enhanced to enable server side processing. The HTML controls such as the header tags, anchor tags, and input elements are not processed by the server but are sent to the browser for display. They are specifically converted to a server control by adding the attribute runat="server" and adding an id attribute to make them available for server-side processing. For example, consider the HTML input control: <input type = "text" size = "40" > It could be converted to a server control, by adding the runat and id attribute: <input type = "text" id = "testtext" size = "40" runat = "server" > Advantages of using HTML Server Controls Although ASP.NET server controls can perform every job accomplished by the HTML server controls, the later controls are useful in the following cases: Using static tables for layout purposes.

ASP.NET - Server Controls

Image
Controls are small building blocks of the graphical user interface, which include text boxes, buttons, check boxes, list boxes, labels, and numerous other tools. Using these tools, the users can enter data, make selections and indicate their preferences. Controls are also used for structural jobs, like validation, data access, security, creating master pages, and data manipulation. ASP.NET uses five types of web controls, which are: HTML controls HTML Server controls ASP.NET Server controls ASP.NET Ajax Server controls User controls and custom controls ASP.NET server controls are the primary controls used in ASP.NET. These controls can be grouped into the following categories: Validation controls - These are used to validate user input and they work by running client-side script. Data source controls - These controls provides data binding to different data sources. Data view controls - These are various lists and tables, which can bind to data from data sourc

ASP.NET - Server Side

Image
We have studied the page life cycle and how a page contains various controls. The page itself is instantiated as a control object. All web forms are basically instances of the ASP.NET Page class. The page class has the following extremely useful properties that correspond to intrinsic objects: Session Application Cache Request Response Server User Trace We will discuss each of these objects in due time. In this tutorial we will explore the Server object, the Request object, and the Response object. Server Object The Server object in Asp.NET is an instance of the System.Web.HttpServerUtility class. The HttpServerUtility class provides numerous properties and methods to perform various jobs. Properties and Methods of the Server object The methods and properties of the HttpServerUtility class are exposed through the intrinsic Server object provided by ASP.NET. The following table provides a list of the properties: Property Description MachineName N

ASP.NET - Event Handling

Image
An event is an action or occurrence such as a mouse click, a key press, mouse movements, or any system-generated notification. A process communicates through events. For example, interrupts are system-generated events. When events occur, the application should be able to respond to it and manage it. Events in ASP.NET raised at the client machine, and handled at the server machine. For example, a user clicks a button displayed in the browser. A Click event is raised. The browser handles this client-side event by posting it to the server. The server has a subroutine describing what to do when the event is raised; it is called the event-handler. Therefore, when the event message is transmitted to the server, it checks whether the Click event has an associated event handler. If it has, the event handler is executed. Event Arguments ASP.NET event handlers generally take two parameters and return void. The first parameter represents the object raising the event and the

ASP.NET - First Example

Image
An ASP.NET page is made up of a number of server controls along with HTML controls, text, and images. Sensitive data from the page and the states of different controls on the page are stored in hidden fields that form the context of that page request. ASP.NET runtime controls the association between a page instance and its state. An ASP.NET page is an object of the Page or inherited from it. All the controls on the pages are also objects of the related control class inherited from a parent Control class. When a page is run, an instance of the object page is created along with all its content controls. An ASP.NET page is also a server side file saved with the .aspx extension. It is modular in nature and can be divided into the following core sections: Page Directives Code Section Page Layout Page Directives The page directives set up the environment for the page to run. The @Page directive defines page-specific attributes used by ASP.NET page parser and comp

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: Application Life Cycle 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 class ApplicationManager is created. An object of the class HostingEnvironment is created to provide information regarding the resources. Top level items in the application are compiled. Response objects are created. The application objects such as HttpContext, HttpRequest and HttpResponse are created and initialized. An instance of the HttpApplication object is created and assigned to the r

ASP.NET - Environment

Image
ASP.NET provides an abstraction layer on top of HTTP on which the web applications are built. It provides high-level entities such as classes and components within an object-oriented paradigm. The key development tool for building ASP.NET applications and front ends is Visual Studio. In this tutorial, we work with Visual Studio 2008. Visual Studio is an integrated development environment for writing, compiling, and debugging the code. It provides a complete set of development tools for building ASP.NET web applications, web services, desktop applications, and mobile applications. Installation Microsoft provides a free version of visual studio which also contains SQL Server and it can be downloaded from www.visualstudio.com . Step 1 − Once downloading is complete, run the installer. The following dialog will be displayed. Step 2 − Click on the Install button and it will start the installation process. Step 3 − Once the installation process is completed succes