Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

C#

Articles on C# programming language.

ASP 4.0 – Label Control | Lab #004

Step 4 - Assign Label Text At Runtime

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.

Continue Reading →

ASP 4.0 – Understanding Page Events | Lab #003

Step 5 - Start Debug and Observe the Output

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.

Continue Reading →