Monday, March 22, 2010

.NET 4 Data & Services 70-515 Exam Prep ASP.NET – Catto Code Crackin #5

.NET 4 Data & Services 70-515 Exam Prep ASP.NET – Catto Code Crackin #5

Hey Now Everybody,

In this 5th post of the Catto Code Crackin series we’ll continue with the section ‘Working with Data & Services’. In the .NET 3.5 exam ‘Working with Data & Services’ are ~17%. In the .NET 4 exam the section is listed as ‘Displaying & Manipulating Data’ is listed as 19%. Data to me is very fun to work with. It’s one topic that where I’m very interested in learning new data access layers & spending time developing with data driven sites.

Microsoft announced the .NET 4.0 Beta Exams on St. Patrick’s Day which are a free exam & if passed you get certified. Much of the study & prep materials are not available yet, therefore I’ve been studying for a similar exam 70-562 which is the .NET 3.5 ASP.NET Application Development. I hope by posting this content it will help myself along with other people in the community learn & get excited about .NET 4. If you are serious about studying for a MS Exam 2 must have resources: the Self Paced training books are a great books to buy along with practice exams from eBay.

Let’s start with taking a look at the official skills measured from MS.

Displaying and Manipulating Data (19%)

· Implement data-bound controls.
This objective may include but is not limited to:
advanced customization of DataList
Repeater,
ListView,
FormsView,
DetailsView,
TreeView,
DataPager,
Chart,
GridView
This objective does not include:
working in Design mode

· Implement DataSource controls.
This objective may include but is not limited to:
ObjectDataSource,
LinqDataSource,
XmlDataSource,
SqlDataSource,
QueryExtender,
EntityDataSource
This objective does not include:
AccessDataSource,
SiteMapDataSource

· Query and manipulate data by using LINQ.
This objective may include but is not limited to:
transforming data by using LINQ to create XML or JSON,
LINQ to SQL,
LINQ to Entities,
LINQ to objects,
managing DataContext lifetime
This objective does not include:
basic LINQ to SQL

· Create and consume a data service.
This objective may include but is not limited to:
WCF,
Web service;
server to server calls;
JSON serialization,
XML serialization
This objective does not include:
client side,
ADO.NET Data Services

· Create and configure a Dynamic Data project.
This objective may include but is not limited to:
dynamic data controls,
custom field templates;
connecting to DataContext and ObjectContext

Now that we’ve reviewed the skills measured on the .NET 4 exam data section let’s go to the .NET 3.5 book & review a three chapters key points:

· When working with disconnected data, a DataTable object is always required.

· The DataTable object contains DataColumn objects, which define the schema & DataRow objects, which contain the data. DataRow objects have RowState & DataRowVersion properties

· You use the RowState property to indicate whether the DataRow should be inserted, updated, or deleted from the data store when the data is persisted to a database.

· The DataRow object can contain up to three copies of its data, based on the DataRowVersion. This feature allows the data to be rolledback to its original state, & you can use it when you write code to handle conflict resolution.

· The DataSet object is an in memory relational data representation. The DataSet object contains a collection of DataTable objects and a collection of DataRelation objects.

· DataSet & DataTable objects can be serialized & deserialized to and from a binary or XML file or stream. Data from other DataSet, DataTable, & DataRow objects can be merged into DataSet object.

· LINQ to DataSet provides a mechanism for writing complex queries against in memory data using C# or VB.

· Connected classes, also known as provider classes, are responsible for movement of data between the data store & the disconnected classes. A valid DbConnection object is required to use most of the primary provider classes.

· You use the DbCommand object to send a SQL command to a data store. You can also create parameters & pass them to the DbCommand object.

· The DbDataReader object provides a high-performance method of retrieving data from a dta store by delivering a forward only, read only, server-side

· The SQLBulkCopy object can be used to copy data from a number of source to a SQL Server table.

· You can use the DbDataAdapter object to retrieve & update data between a DataTable and a data store. The DbDataAdapter can contain a single SelectCommand for read-only data, or it can contain a SelectCommand,for InsertCommand, UpdateCommand And DeleteCommand for fully updatable data.

· The DbProviderFactory object helps you create provider-independent code, which might be necessary when the data store needs to be quickly changeable

· Use the Using statement to ensure that the Dispose method is called on the connection and command objects to avoidconnection leaks

· You can use the DbProviderFactories object to obtain a list of the provider factories that are available on a computer.

· You can work with BLOBs using the same techniques you use for smaller data type unless the objects are too large to fit into memory. When a BLOB is too large to fit into memory. You must use streaming techniques to move the data.

· You can use LINQ to SQL to create an O/R map of you databse. Programming against an automatically generated O/R map makes database programming faster & easier by providing design-time type checking & IntelliSense against you data tables and their columns.

· XML Documents can be access by using the DOM

· The XPathNavigator uses a cursor model & XPath queries to provide read only random access to the data

· The XmlReader provides an object for validating against DTD, XDR or XSD by setting the XmlReaderSettings object properties

· LINQ to XML uses the XElement class to load XML data, write LINQ queries against it and write the data back if need be. You can also functionally define XML in your code using LINQ to XML.

· ASP.NET provides a number of data source controls that allow you to easily work with various types of data. This includes binding to data using data-bound Web server controls.

· You can pass parameters to most data source controls. A parameter can be bound to a value in a cookie, the session, a form field, the query string or similar object.

· You can cache data using many of the data source controls. This includes the Object DataSource, SQLDataSource & AccessDataSource controls.

· Simple data bound controls consist of controls that inherit from the ListControl such as DropDownList, ListBox, CheckBoxList, BulletedList, & RadioButtonlIst. For these controls, you set the DataTextField to the name of the column that contains the data you wish to display to the user. You set the DataValueField to the column that contains the values you wish to return to the server for a selected item.

· Composite data bound consist of the GridView, DetailsView FormView, Repeater, ListView & DataList controls. The GridView & DetailsView controls show data as tables. The other controls allow you to define templates for laying out your data. The gridview is personally the data control that I use the most.

· Hierarchical data bound controls consists of the Menu & TreeView controls. These controls are used for displaying data that contains parent child relationships.

· You can create an XML Web service in ASP.NET by defining an .asmx file. You use the attribute class WebServiceAttribute class WebServiceAttribute to mark a class as a Web Service. You use the WebMethod attribute class to define the methods on that class that should be exposed as web services. You can also inherit from WebService if you intend to use the features of ASP.NET inside your service.

· You secure a Web service in ASP.NET as you would any other ASP.NET resource. You can also define custom Web service security through custom SOAP headers.

· You call a Web service from the client using ASP.ENT AJAX extensions. You use the scriptmanager cals to reference a Web service that is in the same domain as the given web page. A Javascriipt client proxy is then generated for you. You an use this proxy to call your web service. ASP.NET AJAX does the rest.

· You can consume a XML web service in an ASP.NET web site by setting a Web reference to it. This generates the proxy class.

· WCF is a unifying programming model for creating service orientated apps. With WCF you can create services that work with HTTP, TCP, MSMQ & named pipes

· You write WCF service by first defining a contract typically as an interface. The contract uses the attribute classes ServiceControl and OperationContract to define the service and its method.

· ASP.NET & IIS allow you to host WCF services that you wish to expose as HTTP. You can use this model to write services that take advantage of ASP.NET features such as session state & Security.

Need Chapter 8 & 9

Here are some key points from some sample exams:

1 The DataTextField is used to display text to the user.

The DataValueField is used to return values for selected items.

2 TypeName is used to indicate the name of the class you intend to use for your object-based data source control.

SelectMethod is used to indicate a method on your object used for selecting data.

3 The InfoMessage event displays informational messages as well as the output of the SQL Print statement.

4 The GridView control allows for the display of multiple rows of data and allows users to update that data.

The ListView implicitly supports displaying data in a list and updating that data.

5 The LinqDataSource can be used to connect to a context map defined for your database.

6 Setting the key Asynchronous Processing =true for the connection string will allow you to access data asynchronously.

7 The CacheDuration attribute defines for how long the data of the control should be cached.

The EnableCaching attribute is used to turn on caching for the given data source control.

8 Use the XmlDocument class to create a new XML document from scratch.

9 A WCF Service application is an ASP.NET Web site that is set up to define and expose WCF services.

10 Client certificates can be secured and verified by a third party.

11 The Close method of the DbConnection class will clean up the connection.

The Using block ensures the Dispose method is called (which cleans up connections).

12 The Parse method parses a string into an XElement.

To write your query, you define an IEnumerable<XElement> variable.

13 The DataContract attribute class indicates your class can be serialized with WCF.

The DataMember attribute indicates public members that should be serialized as part of the DataContract.

14 The XmlConvert class is used for data conversions between XML and .NET Framework data types.

15 The DataView can be used for each sort.

16 The WebService class is a base class that will allow your Web service to have access to session state and more.

17 You can use the DataRelation object to navigate from a child to the parent or from the parent to a child.

18 You need to generate an O/R map to use LINQ to SQL. You can do so with SqlMetal. You can also use the O/R designer or hand-code your map.

You must reference the System.Data.Linq namespace to use the features of LINQ to SQL.

The DataContext object is the connection between your O/R map and the actual database.

19 Primary keys must be defined or the changed data will be appended into the destination DataSet instead of being merged.

20 The AsEnumerable method of the DataTable is used to define a LINQ query.

The Where clause can be set to select only those vendors that are active.

The Order By clause will sort the vendors by a given field.

21 The DropDownList control can display a list that uses a minimum amount of space.

22 Setting the IsOneWay parameter to true indicates that the operation does not return a response

23 The Add Web Reference dialog box will find the Web service and its description and generate a proxy for use by your Web site.

The proxy class will provide access to the Web service.

24 Get 32 more questions

In this second section we’ll use the number 2.1, 2.2 & we’ll continue with some key points from a practice exam:

2.1  You add a reference to a WCF service that is deployed on the app server by in Solution explorer right click you project & select add service reference.

2.2 On a WCF service deployed on an app server has a reference added. The net admin reconfigs the WCF service to use TCP. Locate the configuration in the <system.servicesModel> section of the apps web.config file to modify the binding in the <bindings> section. Since the service binding on the server was adjusted we must reconfigure the client binding in the <bindings> section of the config.

2.3 Executing a proc & display the value returned in a textbox. We use parameterized SQL Queries to retrieve and return value from stored procs:

cmd.Parameters.Add(new

SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4,

ParameterDirection.ReturnValue, false, ((System.Byte)(10)),

((System.Byte)(0)), "", System.Data.DataRowVersion.Current,

null));

cmd.ExecuteNonQuery();

ResultsTextBox.Text =

(int)cmd.Parameters["@RETURN_VALUE"].Value.ToString();

2.4. Configure a data source control to access the Contacts collection:

<asp:LinqDataSource

ContextTypeName="AdventureWorksDataContext"

TableName="Contacts"

ID="DataSource1"

runat="server">

</asp:LinqDataSource>

Use the LinqDataSource to access a LINQ query. Set the ContextTypeName to the DataContext class and set the TableName to the name of the property that gives the collection of objects returned by a query.

2.5 A XML Web Service with a reference is redeployed to a prod server. To ensure your app can be updated to use the prod server URL w/out recompiling code you can set the URL property of the web service proxy using a value read from configuration.

2. 6 Code to execute an asynchronous query.

SqlConnection conn = new SqlConnection(connectionString);

SqlCommand db = new SqlCommand("SELECT ID, Contact FROM Vendors", conn);

conn.Open();

AsyncCallback callback = new AsyncCallback(DisplayResults);

db.BeginExecuteReader(callback, db);

To create a connection string that will allow the query to execute ensure the string includes

Async = ture

The SqlCommand.BeginExecuteReader starts an asynchronous database query. To use asynchronous queries, you must have Async=true in the connection string. In addition, the callback method must accept an IAsyncResult object as a parameter.

2. 7  A reference is added to a WCF service deplaoyed on an app server. To identify the location of the service contract schema to debug an issue identify the location of the application’s App_WebReferences folder

The App_WebReferences folder contains files used to create a reference to a WCF service (in the same project or external to the project), including schema files that detail the contract.

2.8  An ASP.NET web app must access a class with the fully qualified name Contoso.Financial.MarketDataSet that implements the following interface.

interface IMarketDataSet

{

DateTime BeginDateTime {get;}

DateTime EndDateTime {get;}

string Security {get;}

ICollection<MarketData> Prices { get; }

}

The configuration  to configure an ObjectDataSource control to expose the Prices collection is:

<asp:ObjectDataSource  ID="DataSource1"  runat="server" TypeName="Contoso.Financial.MarketDataSet" SelectMethod="Prices" />

Set TypeName to the type of the data source.
Set the SelectMethod to the type that returns the collection to which to bind.

2.9  An ASP.NET web page calls an XML web service that requires callers to authenticat with Windows credentials. Set the UseDefaultCredentials property of the Web service proxy to True when you provide the credentials that represent the user name, the password, and the domain of the process executing your Web application and using security best practices.

To supply the credentials of the current process, set the UseDefaultCredentials property of the Web service proxy to True, and set the Credentials property of the Web service proxy to the CredentialCache.DefaultCredentials property. This provides the users' credentials to the Web service.

2.10 A TableAdapter is a type class that provides communication between your application and a database. More specifically, a TableAdapter connects to a database, executes queries or stored procedures, and either returns a new data table populated with the returned data or fills an existing DataTable with the returned data. TableAdapters are also used to send updated data from your application back to the database. A TableAdapter is similar to a DataAdapter except that a TableAdapter can contain multiple queries. Each query added to a typed TableAdapter is exposed as a public method that is simply called like any other method or function on an object.

2.11 For straightforward transforms to HTML, use the Xml server control. Set the DocumentSource property to the XML file and set the TransformSource to the XSL file.

2.12    Set DataSource when you are linking a data-bound control to an object that implements the IEnumerable interface, such as Array, ArrayList, Hashtable, or when you are linking to a DataSet object.

2.13  A page is added to our web app that calls an XML Web service. The following code segment shows the invocation of the Web service using the StockProxy proxy class.

StockProxy proxy = new StockProxy();

Proxy.Credentials = CredentialCache.DefaultCredentials;

Int result = proxy.GetPortfolioValue();

After deplying the page the performance degrades. To improve performance call the Web service by using the proxy's asynchronous method in a PreRequestHandlerExecute event handler. Calling the Web service by using the proxy's asynchronous method in a PreRequestHandlerExecute event handler will solve the problem. The page code can access results from the preprocessing.

2.14 An ASP.NET Web app needs to:

* Expose data contained in a .CSV.

* Allow other controls to use data binding to display data exposed by this control.

We can create control that extends the DataSourceControl class. Create a custom data source by extending the DataSourceControl class to allow other users to access the data by using data binding

2. 15 An ASP.NET Web page that validates and processes uploaded XML files. XML that adheres to your schema:

<subscribers>

<subscriber class="primary" phone="555-555-1212">

<pcp id="2432" />

<name firstName = "Guido" lastName = "Pica"/>

<address street="1 elm way" city="Watertown" state="MA" zip="01322" />

</subscriber>

<subscriber class="primary" phone="555-555-1211">

<pcp id="2432" />

<name firstName = "Tanja" lastName = "Plate"/>

<address street="12 Oak Rd." city="Pondville" state="MA" zip="01311" />

</subscriber>  <subscriber class="primary" phone="555-555-1222">

<pcp id="2432" />

<name firstName = "Armando" lastName = "Pinto"/>

<address street="10 Pine St." city="Riverland" state="MA" zip="01321" />

</subscriber>

<subscriber class="primary" phone="555-555-1211">

<pcp id="2432" />

<name firstName = "Jeff" lastName = "Price"/>

<address street="1 Oak Rd." city="Pondville" state="MA" zip="01311" />

</subscriber>

</subscribers>

You load the XML file into an XmlDocument object named doc. You need to add code to create a list of subscribers in Zip code 01311 and display the list in the ListBox control named namesListBox. The following is what you could use:

XmlNodeList xnl = doc.SelectNodes("subscribers/subscriber/address[@zip = '01311']");

foreach (XmlNode xn in xnl)

{

string firstName = xn.ParentNode.SelectSingleNode("name").Attributes["firstName"].Value;

string lastName = xn.ParentNode.SelectSingleNode("name").Attributes["lastName"].Value;

string fullName = firstName + " " + lastName;

namesListBox.Items.Add(fullName);

}

The code samples have differences in the XPath parameter passed to the XmlDocument.SelectNodes method. Given the sample document, identifying the correct nodes requires an XPath of subscribers/subscriber/address[@zip = '01311']. Attributes such as Zip code must always be prefaced with an @ symbol. To identify child nodes, you must list every node in the path, including the top-level node.

2.16 A Web page will access a database. You need to choose a SqlCommand method to execute the following query with the least overhead.

SELECT COUNT(*) FROM CUSTOMERS

Use ExecuteScalar when you need the first row of results returned.

2.17 Given:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

SelectCommand="SELECT [au_id], [au_lname], [au_fname], [phone],

[address], [city], [state], [zip] FROM [authors]"

ConnectionString="<%$ ConnectionStrings:Pubs %>" />

Add a GridView control to display columns labeled First Name, Last Name and Phone #. These columns should contain the table's au_fname, au_lname, and phone column values.

<asp:GridView ID="GridView1" DataSourceID="SqlDataSource1"

AutoGenerateColumns="False"

runat="server">

<Columns>

<asp:BoundField HeaderText="First Name" DataField="au_fname" />

<asp:BoundField HeaderText="Last Name" DataField="au_lname" />

<asp:BoundField HeaderText="Phone #" DataField="phone" />

</Columns>

</asp:GridView>

This was a good example.

2.18 A Web page that will access a database. You need to choose a SqlCommand method to execute a statement that performs database optimizations without returning results.

ExecuteNonQuery is the best method for running SQL commands that do not return results.

2.19 An ASP.NET Web page that will load a large XML document and use XPath to search and filter XML data. An in-memory representation that will provide the best performance and support document editing is XmlDocument.

You can read an XML document using either XPathDocument or XmlDocument (both in the XPath namespace).XPathDocument provides better performance but does not support editing.

2.20 An application that creates XML documents ensuring that the document includes a namespace declaration and all elements are prefix qualified create an XmlNamespaceManager associated with the XmlDocument. Add the namespaces to the XmlNamespaceManager. Reference the related namespace when adding elements.

XmlNamespaceManager is a class that is designed to resolve, add, and remove namespaces from a collection and provide namespace scope management for the namespaces. You can create an XmlNamespaceManager class whenever you want to hold namespaces in a collection, and the collection associates the namespace prefix and their URLs. Create an XmlNamespaceManager associated with the XmlDocument and add namespaces to it. Reference the namespaces in the XmlElements that you add.

2.21 An ASP.NET Web application must access an XML data file defined by a complex schema. Choose a data source control and configure it to expose the XML data modified to a simplified schema.

The correct procedure is to do the following.

* Add an XmlDataSource.

* Set the DataFile attribute to the name of the XML data file.

* Define an XSL file to transform the XML and set the Transform attribute to the name of the XSL file.

2.22 The App_WebReferences folder contains files used to create a reference to a Web service (in the same project or external to the project), including .disco and .wsdl files.

2.23 Use the TableAdapter object to add rows, delete rows, or update rows in a database.

2.24

SqlCommand db = new SqlCommand(

"SELECT ID, Contact FROM Vendors", conn);

conn.Open();

SqlDataReader rdr = db.ExecuteReader();

while (rdr.Read())

vendors.Items.Add(rdr.GetString(0).Trim() +

", " + rdr.GetString(1));

When dynamically creating queries, it is more reliable to name the columns you want to retrieve than to use the * SQL operator. Although * will retrieve all columns, you need to access individual columns by naming the column number. If the table later changes structure because a column is added or removed, the results returned by column number will change, causing unpredictable results in your application. However, if you name the columns in the query, you will always have control over which columns are associated with which column numbers.

2.25    A data-driven ASP.NET Web app configuring a SqlDataSource control to meet the following requirements.

* If a cached item is not accessed for five minutes it is removed.

* The most frequently used items should remain cached in memory longer.

<asp:SqlDataSource

ID="SqlDataSource1"

EnableCaching="true"

CacheExpirationPolicy="Sliding"

CacheDuration="300"

ConnectionString="Server=localhost;database=Items"

SelectCommand="SELECT * FROM Products"

Runat="server" />

To keep frequently accessed items in memory longer, enable a sliding expiration policy by setting theCacheExpirationPolicy attribute to Sliding. When this attribute is enabled, the expiration timer for each item is reset when the item is accessed. Therefore, items that are not accessed will be removed from the cache when the timer expires, but the timer will continue to be renewed for frequently accessed items.

2.26 A Web page that calls a WCF service. The WCF service requires credentials of type UserNamePasswordClientCredential. Provide the credentials by:

wcfTs.ClientCredentials.UserName.UserName = userName;

wcfTs.ClientCredentials.UserName.Password = password;

To supply credentials of type UserNamePasswordClientCredential set properties of the UserName property.

2.27 Your Web application includes a collection named pairs that contains NameValuePair objects. The NameValuePair class implements the following interface.

interface INameValuePair

{

int ID { get; }

string Name {get;}

}

You must configure the ListBox to meet the following requirements.

* The ListBox displays the pairs collection.

* The ListBox control's SelectedValue property returns the ID of the selected item.

* The ListBox control's SelectedText property returns the Name of the selected item.

You should:

Set the DataTextField to Name.

Set the DataSource to pairs.

Set the DataValueField to ID.

The correct procedure is to set the DataSource to pairs, set the DataTextField to Name, and set the DataValueField to ID.

Set the DataSourceID to identify a DataSource control to which to bind, not a collection itself.

Set the DataTextFormatString to format the property given by the DataTextField.

2.28 Setting DbDataAdapter.MissingSchemaAction to MissingSchemaAction.AddWithKey configures the following DataColumn properties if they exist at the data source: AllowDBNull, AutoIncrement, MaxLength, ReadOnly, and Unique.

2.29 When configuring a GridView control the property to set to bind the GridView to a DataSource control is the DataSourceID. Set DataSourceID to identify a DataSource control.

2.30 The following XmlDataSource control is on a page:

<asp:XmlDataSource id="PeopleDataSource" runat="server" XPath="/People/Person"        DataFile="~/App_Data/people.xml" />

The people.xml file contains the following XML.

<?xml version="1.0" encoding="utf-8" ?>

<People>

<Person>

<Name>

<FirstName>Jared</FirstName>

<LastName>Stivers</LastName>

</Name>

<Job>

<Title>Attorney</Title>

<Description>Reviews legal issues.</Description>

</Job>

</Person>

<Person>

<Name>

<FirstName>Karina</FirstName>

<LastName>Agerby</LastName>

</Name>

<Job>

<Title>IT Director</Title>

<Description>In charge of corporate network.</Description>

</Job>

</Person>

</People>

To configure a DataList control to display the LastName and Title elements use the following code:

<asp:DataList  id="PeopleDataList" DataSourceID="PeopleDataSource"

Runat="server">

<ItemTemplate>

<table cellpadding="4" cellspacing="4">

<tr>

<td style="vertical-align:top; width:120">

<asp:Label id="LastNameLabel" Text='<%#

XPath("Name/LastName")%>' runat="server" />,

<asp:Label id="TitleLabel" Text='<%# XPath("Job/Title") %>'

runat="server" />

</td>

</tr>

</table>

</ItemTemplate>

</asp:DataList>

You must use an XPATH expression. The correct XPATH expressions are Name/LastName and Job/Title.

2.31 Adding code to a Web page to query a SQL Server database and retrieve a result set. Configuring a GridView control to show the query results. The GridView will dynamically sort and filter results. A result set type to bind to the GridView is a DataTable. Bind to a disconnected DataTable or DataSet to support sorting, filtering and updating.

2.32 An XmlDocument named doc with the following XML:

<subscriber class="primary" phone="555-555-1212">

<pcp id="2432" />

<address street="1 elm way" city="Waterville" state="MA" zip="01322" />

</subscriber>

Add code to change the city from Waterville to Watertown.

XmlNode addressNode = doc.DocumentElement.SelectSingleNode("descendant::address");

addressNode.Attributes["city"].Value = "Watertown";

To modify a node's attribute, first create an XmlNode object representing the node by calling SelectSingleNode and providing an XPath. Then you can directly modify the attribute.

Whew! Let’s got the fun section, the Code!

This example is a nice simple xml data source & display the data in a list using a datasource control:

This is the xml file stored in the App_Data Folder

<?xml version="1.0" encoding="utf-8" ?>

<ProductList>

<Product Id="1A59B" Department="Sporting Goods" Name="Baseball" Price="3.00" />

<Product Id="9B25T" Department="Sporting Goods" Name="Tennis Racket" Price="40.00" />

<Product Id="3H13R" Department="Sporting Goods" Name="Golf Clubs" Price="179.00" />

<Product Id="7D67A" Department="Clothing" Name="Shirt" Price="12.00" />

<Product Id="4T21N" Department="Clothing" Name="Jacket" Price="45.00" />

</ProductList>

Here is the ASPX file:

<form id="form1" runat="server">

<div>

<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="419px"

AllowPaging="True" AutoGenerateRows="False" CellPadding="4"

DataSourceID="XmlDataSource1" ForeColor="#333333" GridLines="None">

<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />

<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />

<FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />

<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />

<Fields>

<asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />

<asp:BoundField DataField="Department" HeaderText="Department"

SortExpression="Department" />

<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />

<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />

</Fields>

<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<EditRowStyle BackColor="#999999" />

<AlternatingRowStyle BackColor="White" ForeColor="#284775" />

</asp:DetailsView>

<asp:XmlDataSource ID="XmlDataSource1" runat="server"

DataFile="~/App_Data/ProductList.xml"></asp:XmlDataSource>

</div>

</form>

. In the next section we’ll check out the ‘Configuring & Deploying Web Applications’ which will include config files, State Management, User Authentication & Autherization, and deploying apps.

As we see we covered the ‘Displaying & Manipulating Data’ section What are your thoughts on this section?

That is all & there will be more,

Catto

1 comment:

Catto said...

Hey Now,
Let's take a look @ one more http://msdn.microsoft.com/en-us/library/bb924552.aspx in the library .NET 3.5. This is a stellar example of 'How to: Create an AJAX-Enabled WCF Service and an ASP.NET Client that Accesses the Service'
It explains how to add a new item 'AJAX-enabled WCF Service' on a web application. The example makes me hungry since it's about sandwich's.
Good night & Thx again,
Catto