mtelligent

View Original

Exam 70-553 - Add and configure Web server controls.

Most of this post was written by Juan Suero, another developer who works for Avanade. Check his blog, Meta Dojo to see some of the other interesting things he has to say.

This is the first post of Section 2 of the subject material that Exam 70-553 covers. This topic has more links than any other section in the guide. Feel free to add more to this or any other section by posting comments.

Section 2

  • Part 1

    Creating and Programming a Web Application

    • Topic 1

Add and configure Web server controls.

  • Add Web server controls to a Web Form.
  • Configure the properties of Web server controls programmatically.
  • Configure Web server control properties by using the Microsoft Visual Studio Property Editor.
  • Specify whether events of a control cause a Web Form to post to the server.
  • Configure a control to receive postback events.
  • Access controls in Web Forms pages when working with naming containers and child controls.
  • Create HTML server controls in the designer.
  • Set HTML server control properties programmatically.
  • Use HTML server controls to programmatically access HTML tags.
  • Create HTML controls as elements in an HTML document.
  • Use the AdRotator Web server control to manage banners and pop-up windows.
  • Use the Button Web server control to send a command to the server when a button is clicked.
  • Display a calendar on a Web page by using the Calendar Web server control.
  • Implement the CheckBox Web server control.
  • Implement the FileUpload Web server control.
  • Create and manipulate links on a Web Form by using the HyperLink Web server control.
  • Display an image on a Web Form by using the Image Web server control.
  • Implement a button on a Web Form by using the ImageButton Web server control.
  • Define hotspot regions within an image by using the ImageMap Web server control.
  • Use the Label Web server control to display customized text on a Web page.
  • Display a hyperlink style button on a Web Form by using the LinkButton Web server control.
  • Display lists of information by using controls that derive from the ListControl class.
  • Create a Web Form with static text by using the Literal Web server control.
  • Implement pagination for controls on a page by using the Pager Web server control.
  • Use the Panel Web server control to arrange controls in groups on a page.
  • Create a container for a group of View controls by using the MultiView Web server control.
  • Use the View Web server control to create a Web application.
  • Create a mutually exclusive set of choices by using the RadioButton Web server control.
  • Construct a table by using the Table, TableRow, and TableCell Web server controls.
  • Enable users to type information into a Web Form by using the TextBox Web server control.
  • Create a wizard by using the Wizard Web server control to collect data through multiple steps of a process.
  • Use the XML Web server control to create XML data at the location of the control.
  • Customize the appearance of Web server controls by using Web control templates.
  • Programmatically edit settings in a Web site's configuration file.
  • Dynamically add Web server controls to a Web Forms page.

Summary

This section covers some of the basics of ASP.Net which you should be familiar with already if you are taking this test. But there are many new controls introduced in ASP.Net 2.0

With the exception of some specialist controls, such as the Web Parts controls, all the server controls are implemented in 2 namespaces: system.web.ui.htmlcontrols and system.web.ui.webcontrols, as in v1.X.

Controls New to ASP.Net 2.0 include:

  • DynamicImage automatically translates an image into the correct format
  • ImageMap (self explanatory)
  • Multiview and View allow developers to create different blocks of UI and insert into the page at runtime
  • Wizard provides multi page wizard type interfaces
  • Web parts Controls (discussed in other sections)

The following details and example of using the Wizard Control is from MSDN2:

With the Wizard control, you use discrete steps to collect data, which allows users to navigate between steps at their discretion and creates a simpler user experience. As a developer, you do not have to worry about making your data persist across pages because the control maintains state while the user completes the various steps.

The Wizard control uses steps to delineate different sections of user data input. Each step within the control is given a StepType to indicate whether it is the beginning step, intermediate step, or completion step. The wizard can have as many intermediate steps as needed. You can add different controls, such as a TextBox or ListBox control, to collect user input. When you reach the Complete step, all of your data is accessible. The following code example illustrates the Wizard control with two steps.

<asp:Wizard ID="Wizard1" Runat="server">
<WizardSteps>
<asp:WizardStep Runat="server" Title="Step 1">
</asp:WizardStep>
<asp:WizardStep Runat="server" Title="Step 2">
</asp:WizardStep>
</WizardSteps>
</asp:Wizard> <asp:Wizard ID="Wizard1" Runat="server"
StepNextButtonText=" Next >> "
StepPreviousButtonText=" << Previous "
FinishCompleteButtonText=" Done! ">

You can customize the behavior of the Wizard control by using custom code and events.

For example, you can intercept the NextButtonClick event, which is raised when the user clicks the Next button and captures the data of the current step. The WizardNavigationEventArgs parameter passed to this event includes the CurrentStepIndex and NextStepIndex properties, enabling you to customize the behavior of the control based on the current and next steps, or to cancel the navigation when the Next button is clicked.

Similarly, you can customize the behavior of the Previous and Finish buttons by using the PreviousButtonClick and FinishButtonClick events. Or you can perform cleanup when the Cancel button is clicked by using the CancelButtonClick event.

  • Login presents the user with the customary username and password textboxes
  • LoginName displays the name of the currently authenticated user
  • LoginStatus displays the login status!
  • LoginView provides 2 templates in which the UI for a section of the page is specified and the appropriate content displayed depending on the authentication status of the current user
  • PasswordRecovery displays a 3-step wizard so the user can have their forgotten password sent to them
  • TreeView generates a collapsible tree view
  • SiteMapDataSource exposes hierarchical XML data in a suitable format for databinding to navigation controls such as the TreeView
  • SiteMapPath displays the hierarchical path through the sites page hierarchy to the current page
  • PostBackURL: used with the Button controls to force the page to be posted to a different
  • SqlDataSource and AccessDataSource
  • ObjectDataSource provides access to data exposed through a strongly typed data layer, thus supporting n-tier techniques
  • XmlDataSource for databinding to control that can display such hierarchical data
  • DataSetDataSource for 'flat' XML documents
  • GridView, DetailsView and FormView are databound controls like the DataGrid of v1.X.
  • ContentPager helps divide pages into separate sections for small screen devices
  • PhoneLink can be used to initiate a phone call
  • programmatic access to the following

o HtmlHead, HtmlTitle and HtmlLink controls.

o HtmlInputPassword, HtmlInputReset and HtmlInputSubmit controls

o BulletedList (<ul> and <ol>)

o FileUpload (<input type="file">

o HiddenField (<input type="hidden">

  • The DynamicImage control
  • The MultiView and View Controls

Look through the resources for details on any of the topics listed in this section.

Other Resources & Links:

The New ASP.NET 2.0 Controls
http://www.aspnetpro.com/NewsletterArticle/2005/07/asp200507so_l/asp200507so_l.asp

Creating Custom Web Controls with ASP.NET 2.0
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/custwebcon.asp

ASP.NET 2.0 Internals
http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnvs05/html/Internals.asp

To add a control using ASP.NET syntax
http://authors.aspalliance.com/aspxtreme/webforms/controls/addingwebservercontrolstowebformspage.aspx

Adding Controls to a Web Forms Page Programmatically
http://authors.aspalliance.com/aspxtreme/webforms/controls/addingcontrolstowebformspageprogrammatically.aspx

Setting Web Server Control Properties Programmatically
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtsksettingwebcontrolpropertiesprogrammatically.asp

Properties Window
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxurfpropertybrowser.asp

Determining the Control that Caused a PostBack
http://ryanfarley.com/blog/archive/2005/03/11/1886.aspx

Postback Event Sample
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconpostbackeventsample.asp

In Search Of ASP.Net Controls
http://odetocode.com/Articles/116.aspx

INamingContainer Interface .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.inamingcontainer(VS.80).aspx

Positioning HTML Elements in Design View
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/csconPositioningElementsInWebPages.asp

Setting HTML Server Control Properties Programmatically
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtsksettinghtmlcontrolpropertiesprogrammatically.asp

Converting HTML Server Controls to HTML Elements
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskconvertinghtmlcontrolstohtmlelements.asp

Choosing between server and client controls
http://www.zdnetasia.com/builder/program/web/0,39044550,39187647,00.htm

AdRotator Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.adrotator(VS.80).aspx

ASP.NET AdRotator - Basic and Extending
http://www.dotnetjunkies.com/Tutorial/3F70C875-15E4-4B67-B234-7F79B27C359D.dcik

Button Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.button(VS.80).aspx

Calendar Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.calendar(VS.80).aspx

CheckBox Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.checkbox(VS.80).aspx

ASP.NET 2.0 FileUpload Control
http://www.c-sharpcorner.com/UploadFile/mahesh/FileUpload10092005172118PM/FileUpload.aspx?ArticleID=79850d6d-0e91-4d7b-9e27-a64a09b0ee6b

FileUpload Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload(VS.80).aspx

HyperLink Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.hyperlink(VS.80).aspx

Image Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.image(VS.80).aspx

ImageButton Class .NET Framework Class Library
http://msdn2.microsoft.com/en-s/library/system.web.ui.webcontrols.imagebutton(VS.80).aspx

Creating a Menu User Control (With Rollovers)
http://aspnet101.com/aspnet101/tutorials.aspx?id=21

Image Maps in ASP.NET 2.0
http://www.developer.com/net/asp/article.php/3528986

ImageMap Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.imagemap(VS.80).aspx

Label Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.label(VS.80).aspx

AssociatedControlID in ASP.NET 2.0
http://bhaidar.net/cs/blog/archive/2006/01/21/35.aspx

LinkButton Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton(VS.80).aspx

Very useful OnClientClick property for developers (in 2.0)
http://weblogs.asp.net/skoganti/archive/2004/10/24/246980.aspx

ListControl Class.NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol(VS.80).aspx

A Crash Course on ASP.NET Control Development: Building Data-Bound Controls
http://www.microsoft.com/indonesia/msdn/ContCrshCrsDB.aspx

Literal Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.literal(VS.80).aspx

Paging in a GridView Web Server Control
http://msdn2.microsoft.com/en-us/library/5aw1xfh3.aspx

Paging in a DetailsView Web Server Control
http://msdn2.microsoft.com/en-us/library/ms227442.aspx

Paging in a FormView Web Server Control
http://msdn2.microsoft.com/en-us/library/ms227443.aspx

Panel Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.panel(VS.80).aspx

ASP.NET 2.0 MultiView Control
http://www.c-sharpcorner.com/UploadFile/mahesh/Multiview10092005215233PM/Multiview.aspx?ArticleID=ad731f33-820e-4968-89fa-393c43872384

MultiView Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.multiview(VS.80).aspx

View Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.view(VS.80).aspx

RadioButton Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.radiobutton(VS.80).aspx

RadioButtonList Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.radiobuttonlist(VS.80).aspx

Table Class .NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.table.aspx

Adding Rows and Cells to a Table Web Server Control
http://www.developerfusion.co.uk/show/4410/4/

Textbox Web Server Control
http://authors.aspalliance.com/das/tutorial/textbox.aspx

A MaxLength compliant Multiline Textbox Control in ASP.NET 2.0
http://www.annsa.com/code/textbox/textbox.aspx

The ASP.NET 2.0 Wizard Control
http://msdn.microsoft.com/msdnmag/issues/04/11/CuttingEdge/

Working with the Wizard Control Using Visual Studio 2005
http://aspalliance.com/766

Xml Web Server Control
http://authors.aspalliance.com/aspxtreme/aspnet/syntax/xmlwebservercontrol.aspx

MSDN: XML Web Server Control
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtsktransformingxmldatainxmlwebcontrol.asp

ASP.NET Web Server Controls Templates
http://msdn2.microsoft.com/en-us/library/h59db326(VS.80).aspx

How to: Create Web Server Control Templates Using the Designer
http://msdn2.microsoft.com/en-us/library/c9cbwsf3(VS.80).aspx

How to: Create ASP.NET Web Control Templates Declaratively
http://msdn2.microsoft.com/en-us/library/3326cdex(VS.80).aspx

How To: Create ASP.NET Web Server Control Templates Dynamically
http://msdn2.microsoft.com/en-us/library/0e39s2ck(VS.80).aspx

Configuration Management in ASP.NET 2.0 - Part 2
http://www.extremeexperts.com/Net/Articles/ConfigurationManagementinASPNETPart2.aspx

The Configuration API in .NET 2.0
http://odetocode.com/Articles/418.aspx

Configuration Members: NET Framework Class Library
http://msdn2.microsoft.com/en-us/library/dx9wh62s.aspx

Dynamic Web Controls, Postbacks, and View State
http://aspnet.4guysfromrolla.com/articles/092904-1.aspx

Dynamically Adding Controls to a Web Page...
http://www.dotnetjohn.com/articles.aspx?articleid=44