additional web server controls

Upload: cvikasgupta

Post on 03-Jun-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Additional Web Server Controls

    1/25

    Chapter 4The Additional WebServer Controls

  • 8/12/2019 Additional Web Server Controls

    2/25

    2 Additional Server ControlsOverview

    This presentation briefly discusses theadditional web server controls

  • 8/12/2019 Additional Web Server Controls

    3/25

    3 Additional Server ControlsThe Additional Controls

    These controls are less frequently usedthan those covered in the previouschapter.

    they are still quite useful to know.

    The controls covered in this chapter can begrouped into two categories:

    those that are container controls

    those that are not.

  • 8/12/2019 Additional Web Server Controls

    4/25

    4 Additional Server ControlsThe Additional Controls

    The Panel , Mul t i Vi ewand Vi ew, Wi zar d,and Pl aceHol der controls' basic functionis to act as a container or parent for othercontrols.

    These container controls have manypowerful features that make them animportant part of any ASP.NET developersrepertoire.

    The other controls covered in this chapter(AdRot at or , Fi l eUpl oad, and Xmlcontrols) are not container controls.

    They perform fairly specialized jobs and assuch may not be used nearly as frequentlyas some other controls.

  • 8/12/2019 Additional Web Server Controls

    5/25

    5 Additional Server ControlsList of the Other Web Server

    Controls

    Displays a check box for selectedtrue or false values.

    Panel

    The MultiView control is a container

    for groups of View controls.

    Mul t i Vi ew,

    Vi ew

    Displays a push button that posts aWeb form page back to the server.Allows a user to upload a file to theserver. Consists of a text box andBrowse button.

    Fi l eUpl oad

    Displays an advertisement banner(i.e., a randomly selected imagethat, when clicked, navigates to anew Web page).

    AdRot at or

  • 8/12/2019 Additional Web Server Controls

    6/25

    6 Additional Server ControlsList of the Other Web Server

    Controls

    Displays an XML file or the results ofan XSLT (Extensible Stylesheet

    Language Transformation)transformation.

    Xml

    Provides a series of interconnectedforms used for collectinginformation incrementally from theuser.

    Wi zar d

    A container control used fordynamically loading other controls.

    Pl aceHol der

  • 8/12/2019 Additional Web Server Controls

    7/25

    7 Additional Server ControlsPanel Control

    The Panel control is a container controlthat can be used as a parent container forplain text, HTML elements, and other webserver controls.

    The Panel control is typically used forcreating group behavior, e.g.

    creating a unique look for an area on apage

    programmatically display and hide groupsof controls.

  • 8/12/2019 Additional Web Server Controls

    8/25

    8 Additional Server ControlsPanel Control

    Panel

    Panel

    (Hidden)

    Panel

    (Visible)

  • 8/12/2019 Additional Web Server Controls

    9/25

    9 Additional Server ControlsMultiView + View

    Like the Panel control the Mul t i Vi ewcontrol is a container control for othercontent and controls.

    The Mul t i Vi ewcontrol is a container for

    groups of Vi ewcontrols. Each of these Vi ewcontrols is also a

    container for other controls and HTMLcontent.

    They are an easier way to selectivelydisplay and hide groups of controls thanusing multiple Panel controls.

    Often no programming is required.

  • 8/12/2019 Additional Web Server Controls

    10/25

  • 8/12/2019 Additional Web Server Controls

    11/25

    11 Additional Server ControlsWeb Wizards

    Web applications often require some typeof wizard-style interface that leads the userthrough a series of step-by-step forms.

    A wizard is thus used to retrieve

    information from the user via a series ofdiscrete steps.

    each step in the wizard asks the user toenter some subset of information.

  • 8/12/2019 Additional Web Server Controls

    12/25

    12 Additional Server ControlsWeb Wizard

  • 8/12/2019 Additional Web Server Controls

    13/25

    13 Additional Server ControlsWeb Wizards

    In regular Windows applications, wizardstend to be modal in that the user can notdo any other processing while the wizard isactive:

    the user can only move forward,backwards, finish, or possibly jump to someother step in the wizard.

    As well, Windows-based wizards arepipelines,

    i.e., a wizard is a chain of processes inwhich there is only one entrance and wherethe output of each step in the process is theinput to the next step.

  • 8/12/2019 Additional Web Server Controls

    14/25

    14 Additional Server ControlsWeb Wizards

    Implementing wizards in web applicationsposes several problems.

    A Windows application can strictly controlhow a wizard is launched, and can easily

    ensure users start and exit the wizard in theappropriate way.

    This is much harder to implement in a webenvironment.

    A user could, for instance, bookmark an

    intermediate step in the wizard and try toreturn to it at some point in the future.

    A web-based wizard must thus be able tomaintain the pipeline nature of the wizardand ensure that the user only ever starts

    the wizard at the first step.

  • 8/12/2019 Additional Web Server Controls

    15/25

    15 Additional Server ControlsWeb Wizards

    Maintaining state information in a multi-page web wizard can also be tricky.

    Since the intent of a wizard is to gatherinformation from the user in a series of

    discrete steps, a web wizard needs to beable to pass information gathered inprevious steps onto the next step.

    This requires repetitive coding for theretrieval and verification of the previous

    steps data. As well, there is typically a great deal of

    repetitive code for the handling ofnavigation within the wizard.

  • 8/12/2019 Additional Web Server Controls

    16/25

    16 Additional Server ControlsWizard Control

    The Wi zar d control in ASP.NET 2.0 makesthe process of creating a web wizardsignificantly easier.

    This control provides a simpler mechanism

    for building steps, adding new steps, orreordering the steps.

    The Wi zar d control eliminates the need tomanage the persistence of your data

    across pages because the control itselfmaintains state while the user completesthe various steps.

  • 8/12/2019 Additional Web Server Controls

    17/25

    17 Additional Server ControlsWizard Control

    St ep One
    Emai l

    Passwor d

    St ep Two

    Shi ppi ng

    Ai r Mai l Fed Ex

  • 8/12/2019 Additional Web Server Controls

    18/25

    18 Additional Server ControlsWizard Styling

    You have a great deal of control over theappearance and behavior of the Wi zar dcontrol.

  • 8/12/2019 Additional Web Server Controls

    19/25

    19 Additional Server ControlsFileUpload Control

    The Fi l eUpl oad control provides amechanism for users to send a file fromtheir computer to the server.

    The control is rendered in the browser as a

    Text Box control and a But t on control.

  • 8/12/2019 Additional Web Server Controls

    20/25

    20 Additional Server ControlsPlaceHolder Control

    The Pl acehol der web server controlenables you to dynamically add servercontrols to a page at run-time.

    The Pl acehol der is an empty container

    control with no HTML rendering on itsown.

    instead, the control renders any childelements it contains.

  • 8/12/2019 Additional Web Server Controls

    21/25

    21 Additional Server ControlsPlaceHolder Control

    There are many situations in which itmight make sense to add a controldynamically at run-time rather thanstatically at design-time.

    A portal application, for instance, mayconsist of only a few pages, each containingPl acehol der controls that are loaded withthe appropriate server and user controls atrun-time according to some algorithm or

    some content in a database.

  • 8/12/2019 Additional Web Server Controls

    22/25

    22 Additional Server ControlsAdRotator Control

    Displays a randomly selectedadvertisement banner (a graphic image).

    The displayed advertisement can changewhenever the page refreshes.

    If a user clicks the ad, he or she isredirected to the target URL specified bythe control.

    The displayed advertisements can also be

    priority weighted; this allows certainadvertisements to be displayed more often.

    The control works by readingadvertisement information stored in aseparate data source, which is usually anXML file.

  • 8/12/2019 Additional Web Server Controls

    23/25

    23 Additional Server ControlsXml Control

    The Xml server control can be used todisplay the unformatted contents of anXML document or the result of an XSLTtransformation.

  • 8/12/2019 Additional Web Server Controls

    24/25

    24 Additional Server ControlsXSLT

    An XSLT document is itself an XMLdocument.

    It is an XML-based programming languagefor transforming XML documents.

    The .NET XSLT parser can thus be used totransform a XML document into an XMLdocument with a different structure, aHTML file, a text file, or almost any othertype of document.

  • 8/12/2019 Additional Web Server Controls

    25/25

    25 Additional Server ControlsXML Control + XSLT

    Xml control in the browser with no XSLT

    Xml control using an XSLT file