Lab Exercises
Lab Exercises
NET
Lab 1
Excercise 1
The different options for the list box must be ASP-XML, DotNET, JavaPro and Unix,C,C++. When the
Submit Form button is clicked after entering the data, a message as seen in the last line of the above
figure must be displayed.
Excercise 2
Write a program to display three images in a line. When any one of the images is clicked, it must be
displayed below. On clicking the displayed image it must be cleared. The screen must look as in the
figure given below:
Lab 2
Excercise 1
Write a simple ASP.NET program to display the following Web Controls:
• A button with text “click me”. The button control must be in the center of the form.
• A label with a text hello
• A checkbox.
The form name must be Web Controls
Excercise 2
Write a program to display “Welcome To Radiant” in the form when the “click” button is clicked. The
form title must be ASP.NET.
Excercise 3
Write a program that displays a button in green color and it should change into yellow when the mouse
moves over it.
Lab 3
Excercise 1
Write a program containing the following controls:
• A ListBox
• A Button
• An Image
• A Label
The listbox is used to list items available in a store. When the user clicks on an item in the listbox, its
image is displayed in the image control. When the user clicks the button, the cost of the selected item is
displayed in the control.
Excercise 2
Excercise 3
Excercise 4
Write a JavaScript code that displays two advertisements alternately. When the user clicks on one of
the advertisements, he/she is redirected to “www.amazon.com”, and the other advertisement
redirects the user to “www.fabmart.com”. The weightage of the amazon advertisement is 50 and that
of the other one is 40. The advertisement should be centered horizontally and should cover 60% of the
width of the screen. Its height should be 80 units. The width of the border should be 5
units.
Lab 4
Excercise 1
Write a program to get a user input such as the boiling point of water and test it to the appropriate
value using CompareValidator.
Excercise 2
Write a program that uses a textbox for a user input name and validate it for RequiredField Validation.
Excercise 3
Write a prgoram that gets user input such as the user name, mode of payment, appropriate credit card.
After the user enters the appropriate values the Validation button validates the values entered.
Lab 5
Excercise 1
Create a Form that receives the user name, address, date, nationality, country preferred for working and
skill sets from the user and stores the user name in the client using cookies. The country preferred data
should appear in a dropdownlist whereas, others should be entered in a textbox. Validate all the
controls. The Form is named “formexp.aspx”. The date should appear between “1/1/1900” and
“1/1/2090”.
Lab 6
Excercise 1
Create an application that illustrates how a content can be buffered.
Lab 7
Excercise 1
Create a Global.asax file with Application variables cont, color1 and gotohp. Create a Session variable
called cont1. Initialize cont as 0 and assign any color to color1. For the variable gotohp, give a hyperlink
to any Website. Use the variables in a Web Form. Try these with the lock and unlock methods.
Lab 8
Excercise 1
1. Create table CANDIDATE with the following columns and datatypes
3. Change the candidate name from ‘S.Raman’ to ‘R.Krishnan’ in the first record in CANDIDATE
table.
4. Drop the table CANDIDATE.
5. Create table Employee with the following columns and datatypes.
Dept Numeric
Name Varchar(20)
Doj Datetime
Sal Float
Desgin Varchar(20)
Lab 9
Excercise 1
Write a program to connect to the master database in SQL Server, in the Page_Load event. When the
connection is established, the message “Connection has been established” should be displayed in a label
in the form.
Excercise 2
Write a program to create a table emp in the master database with the following fields:
Excercise 3
Write a program that updates the ename field of the emp table with the given name, where eno=102.
Excercise 4
Write a program to select those rows from the emp table whose eno >=100.
Lab 10
Excercise 1
Select the names of the employees from the emps table. Retrieve the result in a DataSet and display it
in a CheckBoxList.
Excercise 2
Select names from the emps table. Retrieve the result in a DataSet. Bind the DataSet to a
RadioButtonList and display the result in three diferent forms as follows:
i) The RepeatDirection property of the RadioButtonList is set to horizontal and its RepeatLayout
property is set to Table.
ii) The RepeatDirection property of the RadioButtonList is set to Vertical and its RepeatLayout
property is set to Table.
iii) The RepeatLayout property of the RadioButtonList is set to flow.
Excercise 3
Create a Table, which displays two columns and three rows. The first row displays eno, the second
displays ename and the third displays esal, all of these being retrieved from the emps table. Each of the
above is displayed as a drop-down list, containing all the values of the corresponding column in the
table.
Lab 11
Excercise 1
Write a program that binds the properties ID, Name, Price and Qty of a page to the following values:
ID: 10
Name: Wheat
Price: 14.25
Qty: 1000
Excercise 2
Create a RadioButtonList that displays the names of some flowers in two columns. Bind a label to the
RadioButtonList so that when the user selects an option from the list and clicks on a button, the
label displays the flower selected by the user.
Excercise 3
Bind a CheckBoxList to the pname field of the product table in the master database so that all the
name of the product are displayed as a series of checkboxes.
Lab 12
Excercise 1
Write a program to display the records from the database as shown in the figure:
Note: Create a table Customer with records shown in the above figure.
Excercise 2
Write a program to implement the sorting feature in the customer table as shown in the figure:
Note: Create a table Customer with records shown in the above figure.
Excercise 3
Write a program to implement paging feature in the customer table as shown in the figure below.
Note: Create a table Customer with records shown in the above figure.
Lab 13
Excercise 1
• ASP.NET
• ADO.NET
• C#
It also contains a textbox in which the user has to enter a name and a textarea in which the user has to
enter his comments. When the Submit is clicked, the output should display the name entered in the
textbox and the user-selection from the listbox. All the above should be displayed with the tracing for
the page being enabled.
Excercise 2
Write a Web application that generates the “IndexOutOfRange” exception when a button is clicked.
Instead of displaying the above exception, it redirects the user to a custom error page. All the above
should be done with the trace for the page being enabled.
Excercise 3
Write a Web application that retrieves the names of the employees from the emp table. The trace
for the page should be enabled.
Lab 14
Excercise 1
Create a user control that contains a list of colors. Add a button to the Web Form which when
clicked changes the color of the Form to the color selected from the list.
Excercise 2
Create a user control that displays the current date and time. Include it in a Web Form and refresh
it
each time a button is clicked.
Excercise 3
Create a user control that receives the user name and password from the user and validates
them. If the user name is “Radiant” and the password is “asp.net” then the user is authorized,
otherwise not.
Lab 15
Excercise 1
Create a component that receives two numbers from the user through a Web Form, and based
on the user’s selection it adds or subtracts the two numbers and returns the result to the
Web Form. The result should be displayed in the Web Form.
Excerci
se 2
Create two components, the first of which is an abstract class containing an abstract method. The
second component should implement the first component’s abstract class and returns a string
from the method.
Display the result in a Web Form.
Excercise 3
Create a component that contains an array of 100 integers and a corresponding indexer. From
a Web page, assign values to some of its elements. Then the Web Form should display the first
10 elements of the indexer.
Y
Z