Disclaimer

The views expressed on this weblog are mine alone and do not necessarily reflect the views of my employer, Avanade.

Search
Recomends...
  • Code Complete, Second Edition
    Code Complete, Second Edition
    by Steve McConnell
Login

Code Snippets makes developers more productive

I created this tool to make reusing common functions, queries or other pieces of code easy as pie.

Entries in Microsoft Exam 70-553 (49)

Monday
Apr032006

Exam 70-553 - Implement data-bound controls.

 Section 2

  • Part 2
    Integrating Data in a Web Application by Using ADO.NET, XML, and Data-Bound Controls
    • Topic 1

 

Implement data-bound controls.

  • Use tabular data source controls to return tabular data.
  • Use hierarchical data source controls to display hierarchical data.
  • Display data by using simple data-bound controls.
  • Display data by using composite data-bound controls.
  • Display data by using hierarchical data-bound controls.
  • Use the FormView control to display the values of a single table record from a data source.

Summary

Tabular Data Source Controls are meant to connect data ready components to data sources that represent data in tables. Tabular Data Source Controls include:

AccessDataSource - Represents a connection to an access database
DataSetDataSource - Works with the Xml Representation of a Data Source
ObjectDataSource - Allows binding to a custom Object
SqlDataSource - Represents a connection to a SQL server

Hierarchical data source controls are meant to connect data ready components to data sources that represent xml like data where nodes can nest as much as necessary. Hierarchical data source controls include:

SiteMapDataSource - Gets Data from an ASP.Net SiteMap

XmlDataSource - Loads data from an Xml File, Url, or string (Can be used to bind to results of Web Service that supports get through the Url Property)

The List of Data Controls comes from the ASP.Net 2.0 Quickstart link in the resources.

GridView - Renders data in a grid format. This control is an evolution of the DataGrid control, and can automatically take advantage of data source capabilities.

DetailsView - Renders a single data item in a table of label/value pairs, similar to the form view in Microsoft™ Access. This control can also automatically take advantage of data source capabilities.

FormView - Renders a single data item at a time in a form defined by a custom template. Renders a single data item in a table of label/value pairs, similar to the form view in Microsoft™ Access. This control can also automatically take advantage of data source capabilities.

TreeView - Renders data in a hierarchical tree view of expandable nodes.

Menu - Renders data in a hierarchical dynamic menu (including flyouts).

The FormView supports automatic Updates, Inserts, and Deletes through its associated data source control just like the DetailsView control. To define the input UI for editing or inserting, you define an EditItemTemplate or InsertItemTemplate in addition to the ItemTemplate. In this template you will data bind input controls such as TextBox, CheckBox, or DropDownList to the fields of the data source. Data bindings in these templates use a "two-way" data binding syntax, however, to allow the FormView to extract the values of input controls from the template in order to pass to the data source. These data bindings use the new Bind(fieldname) syntax instead of Eval.

Other Resources & Links:

More Load, Less Code with the Data Enhancements of ASP.NET 2.0
http://msdn.microsoft.com/msdnmag/issues/04/06/ASPNET20Data/default.aspx

Data Source Controls in ASP.Net 2.0
http://msdn.microsoft.com/msdnmag/issues/05/01/DataPoints/

Data Controls (ASP.Net 2.0 Quickstart)
http://www.asp.net/QuickStart/aspnet/doc/ctrlref/data/default.aspx


Sunday
Apr022006

Exam 70-553 - Program a Web application.

Section 2

  • Part 1
    • Topic 3

Program a Web application.

  • Redirect users to another Web page by using a server-side method.
  • Detect browser types in Web Forms.
  • Ascertain the cause of an unhandled exception at the page level.
  • Programmatically access the header of a Web page.
  • Implement cross-page postbacks.
  • Assign focus to a control on a page when the page is displayed.
  • Avoid performing unnecessary processing on a round trip by using a page's IsPostBack property.
  • Access encapsulated page and application context.
  • Avoid unnecessary client-side redirection by using the HttpServerUtility.Transfer method.
  • Avoid round trips by using client-side scripts.
  • Use a page's Async attribute to create a page that has built-in asynchronous capabilities.
  • Convert HTML server controls to HTML elements.

Summary

Redirecting users to other pages through Server Side Methods is accomplished through Response.Redirect, HttpServerUtility.Transfer and Server.Transfer.

The Request object now exposes a Browser Object which can be used to determine the Browser type and capabilities.

At the page level you can subscribe to the Page OnError event which will allow you to get the last error by using Server.GetLastError to get the last exception that occurred.

You can access the header of a web page through the HTMLHead Control as long as you make the Head tag have the RunAt=Server Attribute. You can use it to modify the title, links, scripts, etc.

To Implement Cross Page Postbacks in ASP.Net 2.0 by setting the PostBackUrl property of the button control to the page you want your web form to post to. In the Posted Page you can access the calling page through the PreviousPage property which would be null if it wasn’t a cross page postback. The one tricky situation that could occur is that Validation on the Server side will not occur unless you call the PreviousPage.IsValid method to make sure that the post passed validation.

There are three ways to set focus programmatically using ASP.Net 2.0. You can use the Page.SetFocus Method with the ControlID of the Control you want to set the focus on, You can call the Focus method of the control itself, or you can set the DefaultFocus property of the Form element.

The IsPostBack Property lets you know programmatically if the page was posted back and you can avoid refreshing data that was persisted to Viewstate.

The HttpServerUtility.Transfer method works like the Response.Redirect method but without the extra client side trip.

In ASP.Net you can now set a PageDirective Attribute of Async to true to use the IHttpAsyncHandler. You then can use the AddOnPreRenderComplete method to set a method to be called on the Begin and End of the PreRender event.

You can convert HTML Server controls to html elements by unchecking the runat server property or removing the runtat=”server” attribute from the control in html view.

Other Resources & Links:

Design Considerations for Cross Page Post Backs in ASP.NET 2.0
http://odetocode.com/Articles/421.aspx

How to: Detect Browser Types in ASP.NET Web Pages
http://msdn2.microsoft.com/en-us/library/3yekbd5b.aspx

Web Application Error Handling in ASP.Net
http://www.15seconds.com/issue/030102.htm

HTMLHead Class
http://msdn2.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlhead.aspx

Focus in ASP.Net Controls
http://www.beansoftware.com/ASP.NET-Tutorials/Focus-ASP.NET.aspx

HttpServerUtility.Transfer Method
http://msdn2.microsoft.com/en-us/library/8z9e2zxx.aspx

Wicked Code: Asynchronous Pages in ASP.Net 2.0
http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/

How to: Convert HTML Server Controls to HTML Elements
http://msdn2.microsoft.com/en-us/library/yhwa4c06.aspx

Tuesday
Mar282006

Exam 70-553 - Configure settings for a Web application.

Section 2

  • Part 1
    • Topic 2

Configure settings for a Web application.

  • Configure system-wide settings in the Machine.config file.
  • Configure settings for a Web application in the Web.config file.
  • Manage a Web application's configuration by using the Web Site Administration Tool.

Summary

As was the case in previous versions of ASP.Net, there are many settings that can be defined in both Machine.config and Applications Web.Config. With ASP.Net there are many more settings that can be controlled in both files. Lucky for us, in ASP.Net we also have access to a Web Site Administration tool and mmc tools to make it easier to make changes using a GUI interface that will modify the Xml stored in the configuration files without having to manually modify them.

At the very least be familiar with the Web Site Administration Tool which can be accessed by navigating to webadmin.axd under your applications root. The tool has four tabs: Security, Profile Application and provider. Most of these are discussed in detail in other posts on this site

Other Resources & Links:

Configuration Management in ASP.Net 2.0
http://www.extremeexperts.com/Net/Articles/ConfigurationManagementinASPNET.aspx

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

Sunday
Mar262006

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

Sunday
Mar262006

Reflections on having taken BETA Exam 71-553

The format for Exam 71-533 was different than other Microsoft Exams I has taken in the past. It included 89 total questions broken into groups of 30, 29 and 30. Each Group corresponded to a Section in the list of topics the exam was supposed to cover. And once you finished a section you couldn't go back. Most of the exam focused on just the new features of .Net 2.0

The first section focused on Web Development.

No big surprises if you studied the topics. Questions on Web Parts, Master Pages, Themes, ADO.Net centric questions, SiteMap and TreeView, User Controls, the new Wizard Control, Tracing, The new membership provider model.

The second section focused on Windows Development

It covered a lot of Xml Centric questions, validating a schema, More ADO.Net stuff, MultiThreading with the Background Worker Process, transactions, BulkCopy, Database Factory, Deploying with Click Once, Code Access Security.

The third section was more framework stuff.

It covered Crypto, Generics, Enumerators, Queues, Serialization, DriveInfo, Compressing with GZip and Deflate, Security stuff.

Page 1 ... 4 5 6 7 8 ... 10 Next 5 Entries »