In ASP.Net, Label Controls display static text. A normal html text is light-weight and suitable to display static text. Means, the text will not change during the lifecycle of the webpage. One can use Label control if its text changes at runtime. The Text property of the Label Control will change the display text. In this Step-by-Step, we will see how to use Label control to display text in it.
ASP is called Active Server Pages. ASP 4.0 suits well with Visual Studio 2010. You can read lgacy articles with ASP 2.0 and Visual Studio 2005.
In ASP.Net, the client browser will make a request to get a web page. After displaying the page, user can do further navigation via the displayed webpage. In the server side, the server will raise multiple events during the life cycle of a web page. Some of the page events are below:
Page Init: This stage Initializes the page with controls. If any theme needs to be applied, it will be applied here in this phase.
Load: This stage loads the web page with all the controls. In case of post-back, web server will set control properites from the view state. We will learn more about view state in some other article.
Validate: Uses Validator Control and runs validation.
Event Handle: Runs the post-back events. Note, in web application the event happens on the clients browser and its event routines will run on the server at later stage. For Example, let us say a browsing user triggers the text_changed event on the browser end. The event handler routine for the text_changed will run on the server when the user submites text field containing Web-Form or if a post-back occurred. We will learn about post back later.
Render: In this stage, rendering the page for the web -browser occurs. It is a dynamic html generation stage.
Unload: This stage denotes the unloading of the page from the Server memory. After this stage the page becomes no more.
In ASP.Net, one can enable debug and tracing via the Web Configuration file. Debug will enable web application debugging and tracing will enable generating the diagnostic information about web requests. In this Lab, we will see how to enable Debug and Tracing using Asp.Net Web Configuration Tool.
ASP.Net 4 is a web site development platform in which one can develop rich UI based web sites. Here in all our examples, we will be using Visual Studio 2010 with Dotnet Framework 4. All these examples will work well with the latest versions as well because of backward compatibility. In this example, we will create our first website.