08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 7 ■ .<strong>NET</strong> 3.0: WINDOWS COMMUNICATION FOUNDATION 175<br />

Add a DataGrid control to your <strong>ASP</strong>X page <strong>and</strong> use the Auto Format feature to style it<br />

in the Colorful style. You’ll end up with markup that looks like this:<br />

<br />

<br />

<br />

<br />

Untitled Page<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Next, you’ll add code into the Page_Load event h<strong>and</strong>ler to call the WCF service <strong>and</strong> fill<br />

in the grid with the results of the call. This is done with code like this:<br />

public partial class _Default : System.<strong>Web</strong>.UI.Page<br />

{<br />

protected void Page_Load(object sender, EventArgs e)<br />

{<br />

AddressServiceClient myAddressService = new AddressServiceClient();<br />

string strData = myAddressService.GetAddresses("6105");<br />

XmlDocument xmlDoc = new XmlDocument();<br />

xmlDoc.LoadXml(strData);<br />

XmlNodeReader nRead = new XmlNodeReader(xmlDoc);<br />

DataSet d = new DataSet();

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!