Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

 Controls

 HTML Server Control – The HTML server controls are HTML elements that
include a runat=server attribute. The HTML server controls have the same
HTML output and the same properties as their corresponding HTML tags. In
addition, HTML server controls provide automatic state management and
server-side events.
 Web Server Control – Web controls are similar to the HTML server controls
such as Button, TextBox, and Hyperlink, except that Web controls have a
standardized set of property names.
 Basic Web Control – Basic Web controls provide the same functionality as
their HTML server control counterparts. However, basic Web controls include
additional methods, events, and properties against which you can program.
 Validation Control – Validation controls are used to validate the values
that are entered into other controls of the page. Validation controls perform
client-side validation, server-side validation, or both, depending on the
capabilities of the browser in which the page is displayed.
 List Control – List controls are special Web server controls that support
binding to collections. You can use list controls to display rows of data in a
customized, template's format. All list controls expose DataSource and
DataMember properties, which are used to bind to collections.
 Rich Control – In addition to the preceding controls, the ASP.NET page
framework provides a few, task-specific controls called rich controls. Rich
controls are built with multiple HTML elements and contain rich functionality.
 User Control – Often, you may want to reuse the user interface of your Web
Form without having to write any extra code. ASP.NET enables you to do this
by converting your Web Forms into user controls. User controls, which have
the.ascx file extension, can be used multiple times within a single Web Form.
 Custom Control – In addition to the built-in Web controls, ASP.NET also
allows you to create your own custom controls.

 Creating a simple slideshow


 To give you an overview of the slideshow program you’ll be creating with Web
Matrix, I’ll explain what the slideshow will contain and what functions it will
accomplish: It will contain a list of the pictures you want to display. The list will be
hard-coded into the page. In Chapter 12, I’ll show you another, more flexible way to
establish what pictures to show. It will allow users to click Next and Previous buttons
to move back and forth between the slides. It will keep track of the current slide. As
you create this feature of the slideshow program, you’ll learn how to work with state
management. It will automatically redisplay the first slide after you’ve seen the last
slide that is, it will wrap around. Once you’ve gotten the basic slideshow working,
you’ll create a fancier navigation bar that tells users what slide they’re on (slide 2 of
6, for example). You’ll also add captions to the slides. Incidentally, the slideshow
won’t have a timer it’s strictly manual navigation. Your page will use manual
navigation because you can’t directly create a timer in server-based code. A timer
requires that a program be running to count down the seconds. But remember that
on the server, the page disappears as soon as it’s been sent to the browser, along
with its code. So no code is left to perform the timer countdown. If you want a timer
on the page, you need to code it in client script and run it in the browser. Because
we�re primarily focused on server code in this chapter, we won�t address how to
code the timer here

 Maintaining user Preferences


 There are many ways in which you could ask the user for preferences. In this
example, you’ll create two versions of the preferences page, a page that
illustrates the basic principles of storing preferences, and a “smarter” page
that automatically previews your preference choices. Both versions have the
following basic functionalities: A check box that lets the user choose whether
to show captions. A drop-down list that contains a selection of colors to let
the user set the caption color. A set of option buttons that lets the user select
between three fonts: Arial, Times Roman, and Courier. You’ll also add a
preview feature that shows a sample caption in the color and font that the
user has selected. If the user chooses not to show captions, the sample
caption will disappear. After setting all the preferences, the user clicks a Save
button. The Web page gathers the user’s preferences and stores them in a
cookie. (I’ll discuss cookies in detail later in this chapter.) Finally, the user will
be able to click a button to jump to the slideshow.
 Creating Random quotes page
 To give you an overview of the slideshow program you’ll be creating with Web
Matrix, I’ll explain what the slideshow will contain and what functions it will
accomplish: It will contain a list of the pictures you want to display. The list will be
hard-coded into the page. In Chapter 12, I’ll show you another, more flexible way to
establish what pictures to show. It will allow users to click Next and Previous buttons
to move back and forth between the slides. It will keep track of the current slide. As
you create this feature of the slideshow program, you’ll learn how to work with state
management. It will automatically redisplay the first slide after you’ve seen the last
slide that is, it will wrap around. Once you’ve gotten the basic slideshow working,
you’ll create a fancier navigation bar that tells users what slide they’re on (slide 2 of
6, for example). You’ll also add captions to the slides. Incidentally, the slideshow
won’t have a timer it’s strictly manual navigation. Your page will use manual
navigation because you can’t directly create a timer in server-based code. A timer
requires that a program be running to count down the seconds. But remember that
on the server, the page disappears as soon as it’s been sent to the browser, along
with its code. So no code is left to perform the timer countdown. If you want a timer
on the page, you need to code it in client script and run it in the browser. Because
we’re primarily focused on server code in this chapter, we won’t address how to
code the timer here
 Creating a Page Hit Counter
 If you develop a page that’s popular, the hits can mount up very rapidly indeed. But
even if your page gets only a few visitors, creating a hit counter can be an interesting
exercise because creating a functional hit counter provides you with practical
knowledge of how Web pages work. You can add a hit counter to your page without
actually developing the counter yourself. (See the following sidebar Commercial Hit
Counters.) By developing the hit counter yourself, however, you get to customize
the counters appearance as well as define what constitutes a hit. You also learn
some useful Microsoft ASP.NET programming techniques that will doubtless come in
handy for other purposes. The hit counter we develop in this chapter will not
provide any detailed statistics, such as when your page was visited or by how many
different users. For that we would need to track information in a database, and we
haven’t gotten to databases yet. For now, you’ll be literally counting hits, period.

You might also like