Programming Examples

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


Articles on C# programming language.

ASP 4.0 – Table Control – Lab #010

Step 1 - Add Table Control and Place Cells in Design Time

We know html provides Table tag to form the row and column of data. The table is also used to layout the html elements in a formatted way. Asp 4.0 provides a control called Table and using this we can create tables without using the Tr and Td tags. The Table Control contains one or more TableRow Control and a TableRow Control can have one or more TableCell Controls. ASP.Net derived all these controls from the WebControl class. In this lab, we will create a Table Control and generate row and columns of data. Note, ASP.Net do not remember the content of table control between web requests. The data should be persisted, or one should use sessions. We will learn about session and DB in the later Lab

Continue Reading →

ASP 4.0 – RadioButton Control – Lab #009

Step 3 - Running the Lab Example

ASP 4.0 RadioButton Control allows you to pick one of many values. Radio buttons are a group of controls. For example, if there are 4 radio buttons, a user can keep only one radio button in a checked state within a group. If there are two groups, the user can keep two buttons in checked state. Means, one button in each group can be in a selected state. In this Lab, we will create a Radio Button group and mention which one is in checked state.

Continue Reading →

ASP 4.0 – CheckBox Control – Lab #008

Step 1 - Create Form With CheckBoxes

In the Previous Lab #007, we learnt about the Command Buttons. Now, we will explore how to use ASP 4.0 CheckBox Control. The CheckBox Control is suitable to get a true or false choice from the user. For Example: A CheckBox showing the text Smoker expects only one input from the user, which has two choices (Yes or No). To show the text, one should use the Text property of the CheckBox Control. When the user clicks the CheckBox Control, it will raise the CheckedChanged Event. By default, the Checkbox will not do any Postback, but it can be changed via PostBack property. In this Lab #008, we will explore about the ASP 4.0 CheckBox Control.

Continue Reading →

ASP 4.0 – Command Button & Event – Lab #007

Step 2 - CommandName Property and Command Event

In the previous Lab, Submit Button Control | Lab #006 we learned how to use submit button and handle its click event. In this lab, we will use three Command Buttons and use Command Event to handle the button click. ASP 4.0 supports grouping the buttons and wiring it to a single event handling routine. We can assign a text string to the CommandText property. Command Event handling routine receives the argument CommandEventArgs and we can enquire the CommandText property on this object to know the event producer and take relevant action. Now, we will proceed with the Lab.

Continue Reading →

ASP 4.0 – Submit Button Control | Lab #006

Step 2 - Handle ASP 4.0 Submit Button Click

When you drop a button control on the ASP.Net Web Form, by default it will act as a Submit Button Control. The submit button performs Auto Postback of the Web Form to the web server. This means, when user clicks the button, the browser will send the Form’s data to the web server. Web Server will process the information and replies back to the web browser. This process is called Postback. In this Lab, we will create a web form with a button control and text field and see how button click works & performs Postback.

Continue Reading →