Transcript wk-4-1
Welcome to week – 4-1 of…
Web Development
Using
ASP .NET
CA – 240
Kashif Jalal
Standard
Controls
AdRotator
• AdRotator: The AdRotator Web server control reads advertisement
(ad) information from a data source, which one or more ad records.
You can store ad information in an XML file and then bind the
AdRotator control to the file.
• The AdRotator control selects ads randomly, changing the
displayed ad each time the page is refreshed. Ads can be weighted
to control the priority level of banners, making it possible to have
certain ads display more often than others. You can also write
custom logic that cycles through the ads.
BulletedList
• BulletedList: The BulletedList control
can display static text in a list that is
either unordered (bulleted) or ordered
(numbered).
Buttons
Web server controls make it easy for you to add different types of
buttons to your Web Forms page.
There are three types of button Web-server controls: Button,
LinkButton, and ImageButton each of which appears differently on
Web pages .
Using ASP.NET button Web server controls on ASP.NET Web pages
allows users to indicate that they have completed the form or that
they want to perform a specific command.
Buttons
• LinkButton: Displays a hyperlink-style button control on a Web
page. Renders as a hyperlink in the page. However, it contains
client-side script that causes the form to be posted back to the
server. (You can create a true hyperlink by using the HyperLink Web
server control.)
• ImageButton Allows you to specify a graphic as a button. This is
useful for presenting a rich button appearance. The ImageButton
controls also pinpoint where in the graphic a user has clicked, which
allows you to use the button as an image map.
Calendar
The Calendar control establishes a default look
for the calendar on the page, but you can
change the calendar's overall appearance.
If you set appearance properties for individual
calendar elements, such as today's date, the
selected date, and so on, the individual settings
are based on the default settings you make for
the calendar as a whole. You can also select
from predefined formats.
CheckBox
You add individual CheckBox controls to a page and work with
them singly.
Alternatively, the CheckBoxList control is a single control that acts
as a parent control for a collection of check-box list items. It derives
from a base ListControl class, and therefore works much like the
ListBox, DropDownList, RadioButtonList, and BulletedList Web
server controls. For that reason, many of the procedures for working
with the CheckBoxList control are the same as the procedures for
the other list Web server controls.
DropDownList
The DropDownList Web server control allows users to
select an item from a predefined list. It differs from the
ListBox Web server control in that the list of items
remains hidden until users click the drop-down button. In
addition, the DropDownList control differs from the
ListBox control in that it does not support multi-selection
mode.
FileUpload
The FileUpload Web server control allows you to
provide users with a way to send a file from their
computer to the server. The file to be uploaded
is submitted to the server as part of the browser
request during postback. After the file has
completed uploading, you can manage the file in
your code.
Hyperlink
You can add a hyperlink to your Web
Forms page by placing a HyperLink Web
server control on the page and associating
it with a URL. You can specify that
HyperLink controls render as either text
or as graphics.
Image
The Image Web server control allows you to
display images on an ASP.NET Web page and
manage these images in your own code.
Unlike most other Web server controls, the
Image control does not support any events. For
example, the Image control does not respond to
mouse clicks. Instead, you can create an
interactive image by using the ImageMap or the
ImageButton Web server controls.
ImageButton - ImageMap
• When users click an ImageButton control, a parameter passed to
the event handler for the control's Click event includes the
coordinates indicating where the user clicked. This allows you to
perform different tasks based on where the user clicked.
• ImageMap: Creates a control that displays an image on a page.
When a hot spot region defined within the ImageMap control is
clicked, the control either generates a postback to the server or
navigates to a specified URL.
• An ImageMap control creates a graphic with hotspots that users can
click individually. Creating an ImageMap control consists of creating
the control, specifying the image, and then separately defining the
hotspots.
Label
• If you want to display static text, you can present it by
using HTML — you do not need a Label control. Use a
Label control only when you need to change the
contents or appearance of text programmatically.
• The Label control provides one way to display text in an
ASP.NET Web page. Other options include the HTML
and Literal control.
ListBox
The ListBox Web server control allows
users to select one or more items from a
predefined list. It differs from a
DropDownList control in that it can display
multiple items at once and it optionally
allows the user to select multiple items.
Literal
You can add a Literal Web server control
to your Web Forms page when you want
to set text programmatically without adding
extra HTML tags. The Literal control is
useful as a way to add text into a page
dynamically without adding any elements
that are not part of the dynamic text. For
example, you can use the Literal control
to display HTML that you read from a file
or from a stream.
MultiView - View
The MultiView and View Web server controls act
as containers for other controls and markup, and
provide a way for you to display alternative sets
of controls and markup.
The MultiView and View controls were
designed primarily for use with browsers on
mobile devices, but they are supported in any
ASP.NET page.