Date post: | 08-Apr-2018 |
Category: |
Documents |
Upload: | adnan-amin |
View: | 213 times |
Download: | 0 times |
of 19
8/7/2019 Lesson_04_part 1
1/19
Web Engineering-II
Using ASP.net
Topic: Understanding Standard Web form Controls.
By
Adnan AminLecturer / Software Programmer
Information and Communication Technology (ICT Dept)www.geoamins.com
1By: Adnan Amin (Lecturer/ Software Progr)
8/7/2019 Lesson_04_part 1
2/19
Web Server Controls There are many best capabilities of the
web server controls. AutoPostBack property
Auto browser detection and adaptation.
Latest and Complex web server controls.
Easily connecting to data sources using
database.
By: Adnan Amin (Lecturer/ Software Progr) 2
8/7/2019 Lesson_04_part 1
3/19
The Web control class. All of the web server controls builts from
WebControls class.
System.Web.UI.WebControls
Webcontrols class provides many standards
control properties.
Color, access key, visibility, foreground color, backcolor etc.
Such complex properties can easily apply on
WebControls.
By: Adnan Amin (Lecturer/ Software Progr) 3
8/7/2019 Lesson_04_part 1
4/19
The Web Browser Auto Detection
The web controls have the capabilities of Auto detect the browser
Accordingly generate the code Display the output.
By: Adnan Amin (Lecturer/ Software Progr) 4
Typical Code for ASP.net Button
Generates this HTML in Internet Explorer 7
8/7/2019 Lesson_04_part 1
5/19
Creating Controls using Coding
Textbox
Label
Button
Checkbox
Radio button Listbox
Dropdown list Image
Hyperlink
5By: Adnan Amin (Lecturer/ Software Progr)
8/7/2019 Lesson_04_part 1
6/19
Code for Textbox
This is textbox web control:
Output: This is textbox web control:
Textboxs are used when you want the user to type
or enter letters, numbers, etc. in a form.
6By: Adnan Amin (Lecturer/ Software Progr)
8/7/2019 Lesson_04_part 1
7/19
Coding for Creating Label.
Enter NameOutput:
Label control is used to display message or title or
comments like data. It can used to display both type of
data such as fixed or dynamic.
7By: Adnan Amin (Lecturer/ Software Progr)
8/7/2019 Lesson_04_part 1
8/19
Coding for Creating Button.
8/7/2019 Lesson_04_part 1
9/19
Coding for Creating Checkbox.
CheckboxOutput:
Checkboxes are used when you want the user to select
one or more options of a limited number of choices.
9By: Adnan Amin (Lecturer/ Software Progr)
8/7/2019 Lesson_04_part 1
10/19
Coding for Creating RadioButton.
Male FemaleOutput:
Radio Buttons are used when you want the user to
select one of a limited number of choices.
10By: Adnan Amin (Lecturer/ Software Progr)
8/7/2019 Lesson_04_part 1
11/19
Coding for Creating Dropdownlist.
Select the Subject:
Java
Visual Basic
C++
Output: Select the Subject:
The dropdownlistis used to create a list (drop-down list).
The Listitem tags inside the dropdownlist element define
the available options in the list.
11By: Adnan Amin (Lecturer/ Software Progr)
8/7/2019 Lesson_04_part 1
12/19
Coding for Creating Listbox.
Pakistan
Afghanistan India
Iran
Output:
12By: Adnan Amin (Lecturer/ Software Progr)
Pakistan
Afghanistan
IndiaIran
Listboxs are used when you want the user to select
one of a limited number or multiple of choices.
8/7/2019 Lesson_04_part 1
13/19
DoPractice
By: Adnan Amin (Lecturer/ Software Progr) 13
Enter Your First Name:
Enter Your Second Name:
Open New Website Project in Visual Studio.net and type the following code
8/7/2019 Lesson_04_part 1
14/19
Double Click on Submit Button Type the following code in code behind the page button click even.
By: Adnan Amin (Lecturer/ Software Progr) 14
Protected Sub button1_Click (ByVal sender As Object, ByVal e As System.EventArgs)
Handles button1.Click
Label3.Text = textbox1.TextLabel4.Text = textbox2.Text
End Sub
8/7/2019 Lesson_04_part 1
15/19
Press Ctrl+F5 (run without debugging)
Output
Frist Name: your first name
Last Name: your last name
By: Adnan Amin (Lecturer/ Software Progr) 15
First Name:
Last Name:
Submit
DoPractice
8/7/2019 Lesson_04_part 1
16/19
Find value of selected radio button.
For example, You have two radio buttons for
gender (male and female). The user will
select only one option either male orfemale. How you will determine that the
users selected option is male or female?
Here we will use the conditional statements
such as if-else statement to determine
about the selected option.
By: Adnan Amin (Lecturer/ Software Progr) 16
8/7/2019 Lesson_04_part 1
17/19
Do Practice
Type the following code intoButton_Click event
If RadioButton1.Checked Then
Label2.Text = "Male"
Elseif RadioButton2.Checked Then
Label2.Text = "Female
Else
Label2.Text=No gender
End If
By: Adnan Amin (Lecturer/ Software Progr) 17Fin
dvalue
ofselectedradiobutt
on. Create the Following Controls
RadioButton1
RadioButton2 Label2
Button
8/7/2019 Lesson_04_part 1
18/19
Assignment #1
Issue date: 29/08/2010 Submit before: 01
asp.net web form
By: Adnan Amin (Lecturer/ Software Progr) 18
First Name:
Last Name:
Gender:
Country:
Address:
Male Female
Submit
First Name:Atif
Last Name:Amin
Gender: Male
Country: Afghanistan
Address: Institute of higher
education kabul.
8/7/2019 Lesson_04_part 1
19/19
Thank You! Visit:
www.geoamins.com
Written By
Adnan Amin
By: Adnan Amin (Lecturer/ Software Progr) 19