<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Squarespace Site Server v5.0.0 (http://www.squarespace.com/) on Sat, 06 Sep 2008 02:00:35 GMT--><feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><title>dan-wahlin-blog</title><subtitle>Dan Wahlin's Blog</subtitle><id>http://blogs.interfacett.com/dan-wahlins-blog/</id><link rel="alternate" type="application/xhtml+xml" href="http://blogs.interfacett.com/dan-wahlins-blog/"/><link rel="self" type="application/atom+xml" href="http://blogs.interfacett.com/dan-wahlins-blog/atom.xml"/><updated>2008-08-15T17:18:46Z</updated><generator uri="http://www.squarespace.com/" version="Squarespace Site Server v5.0.0 (http://www.squarespace.com/)">Squarespace</generator><entry><title>Officially Blogging at http://www.weblogs.asp.net/dwahlin</title><id>http://blogs.interfacett.com/dan-wahlins-blog/2008/4/8/officially-blogging-at-httpwwwweblogsaspnetdwahlin.html</id><link rel="alternate" type="text/html" href="http://blogs.interfacett.com/dan-wahlins-blog/2008/4/8/officially-blogging-at-httpwwwweblogsaspnetdwahlin.html"/><author><name>Dan Wahlin</name></author><published>2008-04-08T20:02:25Z</published><updated>2008-04-08T20:02:25Z</updated><content type="html" xml:lang="en-US"><![CDATA[<p>I've been maintaining my blog in two spots but am going to officially put all content at <a href="http://weblogs.asp.net/dwahlin">http://weblogs.asp.net/dwahlin</a> now.&nbsp; Come on over and&nbsp;visit. :-)</p><p>&nbsp;</p>]]></content></entry><entry><title>Silverlight 2.0 Video Tutorials</title><category>ASP.NET</category><category>XML</category><category>C#</category><category>Video</category><category>WPF</category><category>Silverlight</category><category>.NET</category><category>LINQ</category><id>http://blogs.interfacett.com/dan-wahlins-blog/2008/3/9/silverlight-20-video-tutorials.html</id><link rel="alternate" type="text/html" href="http://blogs.interfacett.com/dan-wahlins-blog/2008/3/9/silverlight-20-video-tutorials.html"/><author><name>Dan Wahlin</name></author><published>2008-03-09T05:12:38Z</published><updated>2008-03-09T05:12:38Z</updated><content type="html" xml:lang="en-US"><![CDATA[<p>Silverlight 2.0 provides a new and exciting framework for building rich applications using C#, VB.NET or other languages that are capable of running on multiple operating systems and in multiple browsers.&nbsp; <a href="http://weblogs.asp.net/scottgu" target="_blank">Scott Guthrie</a> recently posted a great set of tutorials on Silverlight 2.0 that are an excellent resource for getting started building Silverlight 2.0 applications.&nbsp; </p><p>Scott recently approved converting the tutorials into video so I've been busy the past few days putting together video tutorials that cover Silverlight 2.0 and the Digg.com application Scott wrote about.&nbsp; Links to the written tutorials and video tutorials are shown below.</p><h3>Silverlight 2.0 Video Tutorials</h3><table style="width: 608px" cellspacing="4" cellpadding="2"><tbody><tr class="even"><td style="width: 414px"><strong>Part 1: Creating &quot;Hello World&quot; with Silverlight 2 and VS 2008</strong></td><td style="width: 89px"><a href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-1-creating-quot-hello-world-quot-with-silverlight-2-and-vs-2008.aspx" target="_blank">Tutorial</a></td><td style="width: 99px"><a href="http://www.smartwebcontrols.com/video" target="_blank">Video Tutorial</a></td></tr><tr class="odd"><td style="width: 414px"><strong>Part 2: Using Layout Management</strong></td><td style="width: 89px"><a href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-2-using-layout-management.aspx" target="_blank">Tutorial</a></td><td style="width: 101px"><a href="http://www.smartwebcontrols.com/video" target="_blank">Video Tutorial</a></td></tr><tr class="even"><td style="width: 414px"><strong>Part 3: Using Networking to Retrieve Data and Populate a DataGrid</strong></td><td style="width: 89px"><a href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-3-using-networking-to-retrieve-data-and-populate-a-datagrid.aspx" target="_blank">Tutorial</a></td><td style="width: 103px"><a href="http://www.smartwebcontrols.com/video" target="_blank">Video Tutorial</a></td></tr><tr class="odd"><td style="width: 414px"><strong>Part 4: Using Style Elements to Better Encapsulate Look and Feel</strong></td><td style="width: 89px"><a href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-4-using-style-elements-to-better-encapsulate-look-and-feel.aspx" target="_blank">Tutorial</a></td><td style="width: 104px"><a href="http://www.smartwebcontrols.com/video" target="_blank">Video Tutorial</a></td></tr><tr class="even"><td style="width: 414px"><strong>Part 5: Using the ListBox and DataBinding to Display List Data</strong></td><td style="width: 89px"><a href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-5-using-the-listbox-and-databinding-to-display-list-data.aspx" target="_blank">Tutorial</a></td><td style="width: 105px"><a href="http://www.smartwebcontrols.com/video" target="_blank">Video Tutorial</a></td></tr><tr class="odd"><td style="width: 414px"><strong>Part 6: Using User Controls to Implement Master/Details Scenarios</strong></td><td style="width: 89px"><a href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-6-using-user-controls-to-implement-master-detail-scenarios.aspx" target="_blank">Tutorial</a></td><td style="width: 106px"><a href="http://www.smartwebcontrols.com/video" target="_blank">Video Tutorial</a></td></tr><tr class="even"><td style="width: 414px"><strong>Part 7: Using Templates to Customize Control Look and Feel</strong></td><td style="width: 89px"><a href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-7-using-control-templates-to-customize-a-control-s-look-and-feel.aspx" target="_blank">Tutorial</a></td><td style="width: 107px"><a href="http://www.smartwebcontrols.com/video" target="_blank">Video Tutorial</a></td></tr><tr class="odd"><td style="width: 414px"><strong>Part 8: Creating a Digg Desktop Version of our Application using WPF</strong></td><td style="width: 89px"><a href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-8-creating-a-digg-desktop-application-using-wpf.aspx" target="_blank">Tutorial</a></td><td style="width: 108px"><a href="http://www.smartwebcontrols.com/video" target="_blank">Video Tutorial</a></td></tr></tbody></table><p><br />View other cool videos on Silverlight 2.0 and additional .NET technologies from the Mix 08 conference:</p><p><u><font style="color: #3399ff" color="#3399ff"><a href="http://visitmix.com/blogs/Joshua/" target="_blank">Joshua Allen's Mix 08 Blog</a></font></u></p><p><br /></p><div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b570659a-ba35-495d-98e6-b7c4487bc698" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">del.icio.us Tags: <a href="http://del.icio.us/popular/Silverlight%202.0" rel="tag">Silverlight 2.0</a>,<a href="http://del.icio.us/popular/C#" rel="tag">C#</a>,<a href="http://del.icio.us/popular/REST" rel="tag">REST</a>,<a href="http://del.icio.us/popular/XML" rel="tag">XML</a>,<a href="http://del.icio.us/popular/LINQ" rel="tag">LINQ</a></div>]]></content></entry><entry><title>SmartWebControls.com Released</title><category>.NET</category><category>LINQ</category><category>Lambdas</category><id>http://blogs.interfacett.com/dan-wahlins-blog/2008/2/27/smartwebcontrolscom-released.html</id><link rel="alternate" type="text/html" href="http://blogs.interfacett.com/dan-wahlins-blog/2008/2/27/smartwebcontrolscom-released.html"/><author><name>Dan Wahlin</name></author><published>2008-02-27T21:48:56Z</published><updated>2008-02-27T21:48:56Z</updated><content type="html" xml:lang="en-US"><![CDATA[<p>Last night we released a new version of the OrgChart.NET ASP.NET server control under a new name of &quot;SmartChartPro&quot;.&nbsp; We decided to give the control a new name since it's capable of doing more than just OrgCharts (although that's what most companies use it for).&nbsp; We also released a&nbsp; new company website named <a href="http://www.smartwebcontrols.com/" target="_blank"><u><font style="color: #800080" color="#800080">SmartWebControls.com</font></u></a> based on .NET 3.5 where <a href="http://www.smartwebcontrols.com/SmartChartProDetails.aspx" target="_blank"><u><font style="color: #800080" color="#800080">SmartChartPro</font></u></a> and other upcoming controls will now reside.&nbsp; </p><p><a href="http://www.smartwebcontrols.com/" target="_blank"><img style="width: 435px; height: 374px" alt="image" src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SmartWebControls.comReleased_C7B5/image_5.png" /></a> </p><p>I decided to use LINQ and Lambdas in conjunction with LINQ to SQL in the back-end data classes for the new site.&nbsp; Using these new technologies saved an enormous amount of time and made the process a lot more fun since we didn't have to go through the tedious process of mapping DataReader properties to custom data entity class properties as we'd done in the past.</p><p>If you or your boss are holding off on .NET 3.5 I'd definitely recommend taking a closer look as your productivity will increase a lot by using the new features it offers plus your code base will be more maintainable into the future.</p>]]></content></entry><entry><title>Getting Ready for Silverlight 2.0</title><category>Silverlight</category><category>.NET</category><id>http://blogs.interfacett.com/dan-wahlins-blog/2008/2/22/getting-ready-for-silverlight-20.html</id><link rel="alternate" type="text/html" href="http://blogs.interfacett.com/dan-wahlins-blog/2008/2/22/getting-ready-for-silverlight-20.html"/><author><name>Dan Wahlin</name></author><published>2008-02-22T16:49:02Z</published><updated>2008-02-22T16:49:02Z</updated><content type="html" xml:lang="en-US"><![CDATA[<P><A href="http://weblogs.asp.net/scottgu" target=_blank mce_href="http://weblogs.asp.net/scottgu">Scott Guthrie</A> just released new information about Silverlight 2.0 including 8 tutorials.&nbsp; It's going to be a "happening" client-side development framework once it's all done!&nbsp; Here's a list of the tutorials he released:</P>

<LI><A href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-1-creating-quot-hello-world-quot-with-silverlight-2-and-vs-2008.aspx" mce_href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-1-creating-quot-hello-world-quot-with-silverlight-2-and-vs-2008.aspx">Part 1: Creating "Hello World" with Silverlight 2 and VS 2008</A></LI>

<LI><A href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-2-using-layout-management.aspx" mce_href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-2-using-layout-management.aspx">Part 2: Using Layout Management</A></LI>

<LI><A href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-3-using-networking-to-retrieve-data-and-populate-a-datagrid.aspx" mce_href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-3-using-networking-to-retrieve-data-and-populate-a-datagrid.aspx">Part 3: Using Networking to Retrieve Data and Populate a DataGrid</A></LI>

<LI><A href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-4-using-style-elements-to-better-encapsulate-look-and-feel.aspx" mce_href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-4-using-style-elements-to-better-encapsulate-look-and-feel.aspx">Part 4: Using Style Elements to Better Encapsulate Look and Feel</A></LI>

<LI><A href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-5-using-the-listbox-and-databinding-to-display-list-data.aspx" mce_href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-5-using-the-listbox-and-databinding-to-display-list-data.aspx">Part 5: Using the ListBox and DataBinding to Display List Data</A></LI>

<LI><A href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-6-using-user-controls-to-implement-master-detail-scenarios.aspx" mce_href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-6-using-user-controls-to-implement-master-detail-scenarios.aspx">Part 6: Using User Controls to Implement Master/Details Scenarios</A></LI>

<LI><A href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-7-using-control-templates-to-customize-a-control-s-look-and-feel.aspx" mce_href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-7-using-control-templates-to-customize-a-control-s-look-and-feel.aspx">Part 7: Using Templates to Customize Control Look and Feel</A></LI>

<LI><A href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-8-creating-a-digg-desktop-application-using-wpf.aspx" mce_href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-8-creating-a-digg-desktop-application-using-wpf.aspx">Part 8: Creating a Digg Desktop Version of our Application using WPF</A></LI>

<DIV class=wlWriterSmartContent id=scid:0767317B-992E-4b12-91E0-4F059A8CECA8:5eb43fb0-b63f-485a-a90d-f87361942d69 style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px">del.icio.us Tags: <A href="http://del.icio.us/popular/Silverlight%202.0" rel=tag mce_href="http://del.icio.us/popular/Silverlight%202.0">Silverlight 2.0</A></DIV>]]></content></entry><entry><title>Testing Email Messages Sent using System.Net.Mail on Windows Vista</title><category>.NET</category><id>http://blogs.interfacett.com/dan-wahlins-blog/2008/2/21/testing-email-messages-sent-using-systemnetmail-on-windows-v.html</id><link rel="alternate" type="text/html" href="http://blogs.interfacett.com/dan-wahlins-blog/2008/2/21/testing-email-messages-sent-using-systemnetmail-on-windows-v.html"/><author><name>Dan Wahlin</name></author><published>2008-02-21T20:34:56Z</published><updated>2008-02-21T20:34:56Z</updated><content type="html" xml:lang="en-US"><![CDATA[<P>I've been developing for months on Windows Vista and had everything I needed at my disposal.&nbsp; Last night, however, I needed to test whether or not email messages were being successfully sent from an ASP.NET application and see what they looked like.&nbsp; I went to look for an SMTP server in Vista Ultimate and quickly found that there isn't one.&nbsp; IIS7 includes email forwarding capabilities, but I wanted a simple SMTP server (or something that could emulate one) so that I could see the email messages that were being sent.&nbsp; </P>

<P>After doing a little research I found a few programs that fit the bill for testing email sent from applications running on Vista.&nbsp; The first is a free program called "Free SMTP Server" that Steve Schofield blogged about awhile back.&nbsp; You can read Steve's post about the application here:</P>

<P><A title=http://blogs.orcsweb.com/steve/archive/2007/09/08/vista-and-an-smtp-server-on-port-25-or-587.aspx href="http://blogs.orcsweb.com/steve/archive/2007/09/08/vista-and-an-smtp-server-on-port-25-or-587.aspx" mce_href="http://blogs.orcsweb.com/steve/archive/2007/09/08/vista-and-an-smtp-server-on-port-25-or-587.aspx">http://blogs.orcsweb.com/steve/archive/2007/09/08/vista-and-an-smtp-server-on-port-25-or-587.aspx</A></P>

<P>Here's what the program looks like while running (it's a stand-alone program rather than a service which actually worked out well for my situation).&nbsp; It allows you to configure the DHCP server and the port that's used which is nice if your ISP blocks port 25.</P>

<P><A href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/TestingEmailFunctionalityonWindowsVista_BA1D/image_2.png" mce_href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/TestingEmailFunctionalityonWindowsVista_BA1D/image_2.png"><IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=340 alt=image src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/TestingEmailFunctionalityonWindowsVista_BA1D/image_thumb.png" width=457 border=0 mce_src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/TestingEmailFunctionalityonWindowsVista_BA1D/image_thumb.png"></A> </P>

<P>The second program was actually even better for my current testing purposes since I really didn't need an SMTP server installed.&nbsp; I needed to see what the actual email messages that were sent looked like to make sure data was formatted properly.&nbsp; The program's called "Antix SMTP Server for Developers" and can be found here:</P>

<P><A title=http://channel9.msdn.com/ShowPost.aspx?PostID=281695#281695 href="http://channel9.msdn.com/ShowPost.aspx?PostID=281695#281695" mce_href="http://channel9.msdn.com/ShowPost.aspx?PostID=281695#281695">http://channel9.msdn.com/ShowPost.aspx?PostID=281695#281695</A></P>

<P><A href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/TestingEmailFunctionalityonWindowsVista_BA1D/image_4.png" mce_href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/TestingEmailFunctionalityonWindowsVista_BA1D/image_4.png"><IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=238 alt=image src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/TestingEmailFunctionalityonWindowsVista_BA1D/image_thumb_1.png" width=463 border=0 mce_src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/TestingEmailFunctionalityonWindowsVista_BA1D/image_thumb_1.png"></A> </P>

<P>This program isn't actually an SMTP server (more of an emulator), but it captures any messages sent to port 25 and stores them in a folder.&nbsp; You can then view the messages directly to make sure they contain the information you were looking for while testing.&nbsp; </P>

<P>There are obviously a lot of full-blown SMTP servers out there that would work, but for testing purposes these two programs did the job for me.</P>

<P><FONT color=#ff0000><STRONG>Update:</STRONG></FONT>&nbsp; <A href="http://weblogs.asp.net/dfindley/archive/2006/04/23/Migrating-from-System.Web.Mail-to-System.Net.Mail.aspx" target=_blank>David Findley</A> posted something that I hadn't thought of using that's even easier.&nbsp; Adding this to web.config will dump email messages sent from an ASP.NET application to the specified path:</P>
<PRE class=code><SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">system.net</SPAN><SPAN style="COLOR: blue">&gt;
  &lt;</SPAN><SPAN style="COLOR: #a31515">mailSettings</SPAN><SPAN style="COLOR: blue">&gt;
    &lt;!--
    </SPAN><SPAN style="COLOR: green">Production setting
    
    &lt;smtp deliveryMethod="Network"&gt;
      &lt;network host="localhost" port="25" /&gt;
    &lt;/smtp&gt;
    
    </SPAN><SPAN style="COLOR: blue">--&gt;

    &lt;</SPAN><SPAN style="COLOR: #a31515">smtp </SPAN><SPAN style="COLOR: red">deliveryMethod</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">SpecifiedPickupDirectory</SPAN>"<SPAN style="COLOR: blue">&gt;
      &lt;</SPAN><SPAN style="COLOR: #a31515">specifiedPickupDirectory </SPAN><SPAN style="COLOR: red">pickupDirectoryLocation</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">C:\TestMessages</SPAN>" <SPAN style="COLOR: blue">/&gt;
    &lt;/</SPAN><SPAN style="COLOR: #a31515">smtp</SPAN><SPAN style="COLOR: blue">&gt;

  &lt;/</SPAN><SPAN style="COLOR: #a31515">mailSettings</SPAN><SPAN style="COLOR: blue">&gt;
&lt;/</SPAN><SPAN style="COLOR: #a31515">system.net</SPAN><SPAN style="COLOR: blue">&gt;</SPAN></PRE><A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"></A>]]></content></entry><entry><title>Building an N-Layer ASP.NET Application with LINQ, Lambdas and Stored Procedures (Updated)</title><category>ASP.NET</category><category>C#</category><category>.NET</category><category>LINQ</category><category>Lambdas</category><id>http://blogs.interfacett.com/dan-wahlins-blog/2008/2/19/building-an-n-layer-aspnet-application-with-linq-lambdas-and.html</id><link rel="alternate" type="text/html" href="http://blogs.interfacett.com/dan-wahlins-blog/2008/2/19/building-an-n-layer-aspnet-application-with-linq-lambdas-and.html"/><author><name>Dan Wahlin</name></author><published>2008-02-19T01:27:00Z</published><updated>2008-02-19T01:27:00Z</updated><content type="html" xml:lang="en-US"><![CDATA[<P><FONT color=#ff0000><STRONG>Update:</STRONG></FONT>&nbsp; I refactored some of the code and also did a better job ensuring Dispose() is called everywhere so that the DataContext object gets cleaned up properly.</P>

<P><A href="http://www.xmlforasp.net/CodeBank/Download/Blog/N-Layer_WithLINQ.zip" target=_blank><STRONG>Download the Application Here</STRONG></A></P>

<P>.NET 3.5 has a lot of great new features that can significantly enhance developer productivity.&nbsp; I've been spending some time lately working on a little sample application that demonstrates how an N-Layer ASP.NET 3.5 application can be built using LINQ, lambdas and LINQ with stored procedures.&nbsp; The application is for a talk I'll be giving at <A href="http://www.devconnections.com/" target=_blank mce_href="http://www.devconnections.com">DevConnections</A> in April discussing how LINQ technologies can be used in an N-Layer architecture.&nbsp; In a <A href="http://weblogs.asp.net/dwahlin/archive/2008/02/17/linq-and-lambdas-and-sprocs-oh-my.aspx" target=_blank mce_href="http://weblogs.asp.net/dwahlin/archive/2008/02/17/linq-and-lambdas-and-sprocs-oh-my.aspx">previous post</A> comparing different LINQ options I mentioned that I'd be posting the code download as soon as it was ready.</P>

<P>The application provides a presentation layer, business layer, data layer and model layer through separate projects as shown next:</P>

<P><A href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/BuildinganNLayerA.NETApplicationwithLINQ_963D/image_2.png" mce_href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/BuildinganNLayerA.NETApplicationwithLINQ_963D/image_2.png"><IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=476 alt=image src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/BuildinganNLayerA.NETApplicationwithLINQ_963D/image_thumb.png" width=199 border=0 mce_src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/BuildinganNLayerA.NETApplicationwithLINQ_963D/image_thumb.png"></A> </P>

<P>It also demonstrates how the new ListView control can be used to display data, perform insert, update and delete operations and nest other controls such as the GridView.&nbsp; Databinding on the presentation layer is mainly done using the ObjectDataSource control.</P>

<P><A href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/BuildinganNLayerA.NETApplicationwithLINQ_963D/image_4.png" mce_href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/BuildinganNLayerA.NETApplicationwithLINQ_963D/image_4.png"><IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=400 alt="Application Example" src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/BuildinganNLayerA.NETApplicationwithLINQ_963D/image_thumb_1.png" width=532 border=0 mce_src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/BuildinganNLayerA.NETApplicationwithLINQ_963D/image_thumb_1.png"></A> </P>

<P>All of the queries performed in the application go against an object model created using the Visual Studio 2008 LINQ to SQL Designer.&nbsp; <BR><BR><FONT color=#ff0000><STRONG>Note:</STRONG></FONT>&nbsp; The included Northwind SQL Express database has been modified slightly to add a TimeStamp field into the Customer and Orders tables.&nbsp; Doing so simplifies updates so be aware that if you change the connection string to point to a standard Northwind database you'll get an error since the TimeStamp fields will be missing.</P>

<P><IMG src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/LINQandLambdasandSprocs.OhMy_89C7/image_2.png" mce_src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/LINQandLambdasandSprocs.OhMy_89C7/image_2.png"> </P>

<H2><BR>3 Options for Data Access</H2>
<P>Rather than focusing solely on LINQ, I wanted to show different options for data access that .NET 3.5 offers so that developers can get a feel for what's available in addition to standard LINQ queries that seem to get most of the attention these days.&nbsp; I ended up creating six main data layer classes as shown next: <BR><BR><STRONG>Customer Query Classes:</STRONG></P>

<UL>
<LI>CustomerDBLINQ - Executes customer related queries using inline LINQ </LI>

<LI>CustomerDBLambda - Executes customer related queries using lambda expressions </LI>

<LI>CustomerDBSprocs - Executes customer related queries using stored procedures and LINQ <BR></LI>
</UL>

<P><STRONG>Order Query Classes:</STRONG></P>

<UL>
<LI>OrderDBLINQ - Executes order related queries using inline LINQ </LI>

<LI>OrderDBLambda - Executes order related queries using lambda expressions </LI>

<LI>OrderDBSprocs - Executes order related queries using stored procedures and LINQ </LI>
</UL>

<P>I still lean toward using stored procedures due to the security and maintenance benefits they offer in more enterprise environments, but for small queries I actually prefer lambda expressions over LINQ (not sure why...just feels more object oriented I guess).&nbsp; If you currently use stored procedures in your applications and haven't checked out the new LINQ to SQL Designer you'll be impressed with how easy it is to call stored procedures and pass parameters.&nbsp; You never have to see or create another SqlCommand or SqlParameter object again (well...in many cases anyway).</P>

<H2><BR>Switching Between Data Access Classes</H2>
<P>By changing a value in web.config you can switch between the different data layer classes and see which option you prefer (LINQ, lambdas or LINQ with sprocs).&nbsp; All of the data access classes perform the same overall tasks, they just use different techniques to do it.</P>
<PRE class=code><SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">appSettings</SPAN><SPAN style="COLOR: blue">&gt;
  &lt;!-- 
    </SPAN><SPAN style="COLOR: green">Used to define which DB layer class should be loaded and used. 
    Valid customer values include:  Data.CustomerDBSprocs, Data.CustomerLINQ, Data.CustomerLambda
    Valid order values include: Data.OrderDBSprocs, Data.OrderLINQ, Data.OrderLambda
  </SPAN><SPAN style="COLOR: blue">--&gt;
  &lt;</SPAN><SPAN style="COLOR: #a31515">add </SPAN><SPAN style="COLOR: red">key</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">CustomerDBType</SPAN>" <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">Data.CustomerDBLINQ</SPAN>" <SPAN style="COLOR: blue">/&gt;
  &lt;</SPAN><SPAN style="COLOR: #a31515">add </SPAN><SPAN style="COLOR: red">key</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">OrderDBType</SPAN>" <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">Data.OrderDBLINQ</SPAN>" <SPAN style="COLOR: blue">/&gt;
  &lt;!-- </SPAN><SPAN style="COLOR: green">When the following key is set to "true" ensure that <BR>       </SPAN><SPAN style="COLOR: green">EnablePartialRendering is set to false on the Default.aspx ScriptManager control </SPAN><SPAN style="COLOR: blue">--&gt;
  &lt;</SPAN><SPAN style="COLOR: #a31515">add </SPAN><SPAN style="COLOR: red">key</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">EnableDataContextLogging</SPAN>" <SPAN style="COLOR: red">value</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">false</SPAN>" <SPAN style="COLOR: blue">/&gt;
&lt;/</SPAN><SPAN style="COLOR: #a31515">appSettings</SPAN><SPAN style="COLOR: blue">&gt;</SPAN></PRE><A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"></A>
<P>Over the next few weeks I'm hoping to make some time to walk through the application pieces.&nbsp; I may create some video tutorials about it as well....we'll see how time goes.</P>

<DIV class=wlWriterSmartContent id=scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ad64d0f8-6190-4c01-b201-ded34dd0d5b4 style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px">del.icio.us Tags: <A href="http://del.icio.us/popular/N-Layer" rel=tag>N-Layer</A>,<A href="http://del.icio.us/popular/LINQ" rel=tag>LINQ</A>,<A href="http://del.icio.us/popular/Lambdas" rel=tag>Lambdas</A>,<A href="http://del.icio.us/popular/Stored%20Procedures" rel=tag>Stored Procedures</A>,<A href="http://del.icio.us/popular/ListView" rel=tag>ListView</A>,<A href="http://del.icio.us/popular/ASP.NET" rel=tag>ASP.NET</A></DIV>

<style type="text/css">
#pageHeaderWrapper { text-align: center;  width: 95%;  background-color: #FFFFFF; text-align: left; margin: 0 auto;border-top:1px solid black;border-left:1px solid black;border-right:1px solid black; }
#pageHeader {  }

#pageBodyWrapper { text-align: center;  width: 95%;  background-color: #FFFFFF; margin: 0 auto; border-bottom:1px solid black;border-left:1px solid black;border-right:1px solid black;}
#pageBody {width:86%;background-color: #FFFFFF; text-align: left; margin: 0 auto; }

#sidebarWrapper { }
#sidebar {float: right; width:20%;margin-top: 5px; overflow: hidden;
 }

#contentWrapper {  }
#content {  width:75%;margin-bottom: 60px; overflow: hidden;  }

#pageFooterWrapper { }
#pageFooter { font-size: 7pt; background: inherit; color: #C1C1C1; padding-top: 5px; margin-top: 25px; padding-top: 4px; width: 95%; }


.code {
    word-wrap:break-word;
    margin:8px;
    padding:8px;
    border:1px solid black;
    background-color:#efefef;
    font-family:Courier New;
    font-size:9pt;
}
</style>

<p>&nbsp;</p>

]]></content></entry><entry><title>LINQ and Lambdas and Sprocs....Oh My!</title><category>C#</category><category>.NET</category><category>LINQ</category><category>Lambdas</category><id>http://blogs.interfacett.com/dan-wahlins-blog/2008/2/17/linq-and-lambdas-and-sprocsoh-my.html</id><link rel="alternate" type="text/html" href="http://blogs.interfacett.com/dan-wahlins-blog/2008/2/17/linq-and-lambdas-and-sprocsoh-my.html"/><author><name>Dan Wahlin</name></author><published>2008-02-17T17:43:07Z</published><updated>2008-02-17T17:43:07Z</updated><content type="html" xml:lang="en-US"><![CDATA[<P>There's a lot of great stuff in .NET 3.5 and several different ways to work with LINQ technologies such as LINQ to SQL.&nbsp; I'm currently putting together some demonstration code for a talk I'll be giving at <A href="http://www.devconnections.com/" target=_blank mce_href="http://www.devconnections.com">DevConnections in Orlando</A> and showing how LINQ, Lambdas and LINQ with stored procedures can be used to do the same thing so that people get a feel for each technique.&nbsp; For shorter queries I generally prefer lambdas since it's more object-oriented feeling compared to LINQ (to me anyway).&nbsp; For more complex queries LINQ is much easier though.&nbsp; Overall, I still prefer stored procedures since you have much more control over security that way and can maintain queries without resorting to C#/VB.NET code changes in some cases.&nbsp; Plus, LINQ makes it really easy to pass parameters to stored procedures without having to create SqlParameter objects (something I've always despised).</P>

<P>Although I've found that I like lambdas a lot for more simple queries, I was working on some lambda code yesterday that was just plain out of control and much more complex when compared to using LINQ or LINQ against a sproc.&nbsp; Here's an example of the overall query I was after which has several inner joins.&nbsp; This particular query was automatically generated using LINQ code and I logged the output and converted it to a stored procedure named ap_GetOrderDetailsByOrderID.&nbsp; It's structured a little differently than I would typically write, but accomplishes the same end goal.</P>
<PRE class=code><SPAN style="COLOR: blue">CREATE PROCEDURE </SPAN>dbo.ap_GetOrderDetailsByOrderID
    (
        @OrderID <SPAN style="COLOR: blue">int
    </SPAN>)
<SPAN style="COLOR: blue">AS
    BEGIN
        SELECT </SPAN>[t5].[CompanyName] <SPAN style="COLOR: blue">AS </SPAN>[ShipperName], 
        [t5].[ProductName] <SPAN style="COLOR: blue">AS </SPAN>[Product], 
        [t5].[value] <SPAN style="COLOR: blue">AS </SPAN>[Total], 
        <SPAN style="COLOR: blue">CONVERT</SPAN>(<SPAN style="COLOR: blue">Int</SPAN>,[t5].[Quantity]) <SPAN style="COLOR: blue">AS </SPAN>[Quantity], 
        [t5].[UnitPrice], 
        [t5].[CompanyName2] <SPAN style="COLOR: blue">AS </SPAN>[SupplierName] 
        <SPAN style="COLOR: blue">FROM </SPAN>( 
            <SPAN style="COLOR: blue">SELECT </SPAN>[t0].[OrderID], 
                    [t1].[CompanyName], 
                    [t2].[UnitPrice], 
                    [t2].[Quantity], 
                    [t3].[ProductName], 
                    [t4].[CompanyName] <SPAN style="COLOR: blue">AS </SPAN>[CompanyName2], 
                    (<SPAN style="COLOR: blue">CONVERT</SPAN>(<SPAN style="COLOR: blue">Decimal</SPAN>(29,4),[t2].[Quantity])) * [t2].[UnitPrice] <SPAN style="COLOR: blue">AS </SPAN>[value] 
            <SPAN style="COLOR: blue">FROM </SPAN>[dbo].[Orders] <SPAN style="COLOR: blue">AS </SPAN>[t0] 
            <SPAN style="COLOR: blue">INNER JOIN </SPAN>[dbo].[Shippers] <SPAN style="COLOR: blue">AS </SPAN>[t1] <SPAN style="COLOR: blue">ON </SPAN>[t0].[ShipVia] = ([t1].[ShipperID]) 
            <SPAN style="COLOR: blue">INNER JOIN </SPAN>[dbo].[Order Details] <SPAN style="COLOR: blue">AS </SPAN>[t2] <SPAN style="COLOR: blue">ON </SPAN>[t0].[OrderID] = [t2].[OrderID] 
            <SPAN style="COLOR: blue">INNER JOIN </SPAN>[dbo].[Products] <SPAN style="COLOR: blue">AS </SPAN>[t3] <SPAN style="COLOR: blue">ON </SPAN>[t2].[ProductID] = [t3].[ProductID] 
            <SPAN style="COLOR: blue">INNER JOIN </SPAN>[dbo].[Suppliers] <SPAN style="COLOR: blue">AS </SPAN>[t4] <SPAN style="COLOR: blue">ON </SPAN>[t3].[SupplierID] = ([t4].[SupplierID]) ) 
        <SPAN style="COLOR: blue">AS </SPAN>[t5] <SPAN style="COLOR: blue">WHERE </SPAN>[t5].[OrderID] = @OrderID 

    <SPAN style="COLOR: blue">END</SPAN></PRE><A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"></A>
<P>The examples that follow go against the LINQ to SQL objects shown next that I created in Visual Studio 2008 using the LINQ to SQL Designer.&nbsp; All of the objects came from the Northwind database except the custom OrderDescription object.</P>

<P><A href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/LINQandLambdasandSprocs.OhMy_89C7/image_2.png" mce_href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/LINQandLambdasandSprocs.OhMy_89C7/image_2.png"><IMG height=456 alt=image src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/LINQandLambdasandSprocs.OhMy_89C7/image_thumb.png" width=700 border=0 mce_src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/LINQandLambdasandSprocs.OhMy_89C7/image_thumb.png"></A> </P>

<P><STRONG><FONT size=4>Using LINQ</FONT></STRONG></P>

<P>LINQ can be used to automatically generate the query shown above by doing the following:</P>
<PRE class=code><SPAN style="COLOR: blue">public override </SPAN><SPAN style="COLOR: #2b91af">IEnumerable</SPAN>&lt;<SPAN style="COLOR: #2b91af">OrderDescription</SPAN>&gt; GetOrderDetails(<SPAN style="COLOR: blue">int </SPAN>orderID)
{
    <SPAN style="COLOR: #2b91af">NorthwindDataContext </SPAN>db = <SPAN style="COLOR: blue">this</SPAN>.DataContext;
    <SPAN style="COLOR: #2b91af">IEnumerable</SPAN>&lt;<SPAN style="COLOR: #2b91af">OrderDescription</SPAN>&gt; orderDetails =
        <SPAN style="COLOR: blue">from </SPAN>o <SPAN style="COLOR: blue">in </SPAN>db.Orders
        <SPAN style="COLOR: blue">where </SPAN>o.OrderID == orderID
        <SPAN style="COLOR: blue">join </SPAN>s <SPAN style="COLOR: blue">in </SPAN>db.Shippers <SPAN style="COLOR: blue">on </SPAN>o.ShipVia <SPAN style="COLOR: blue">equals </SPAN>s.ShipperID
        <SPAN style="COLOR: blue">join </SPAN>od <SPAN style="COLOR: blue">in </SPAN>db.OrderDetails <SPAN style="COLOR: blue">on </SPAN>o.OrderID <SPAN style="COLOR: blue">equals </SPAN>od.OrderID
        <SPAN style="COLOR: blue">join </SPAN>p <SPAN style="COLOR: blue">in </SPAN>db.Products <SPAN style="COLOR: blue">on </SPAN>od.ProductID <SPAN style="COLOR: blue">equals </SPAN>p.ProductID
        <SPAN style="COLOR: blue">join </SPAN>supplier <SPAN style="COLOR: blue">in </SPAN>db.Suppliers <SPAN style="COLOR: blue">on </SPAN>p.SupplierID <SPAN style="COLOR: blue">equals </SPAN>supplier.SupplierID
        <SPAN style="COLOR: blue">let </SPAN>total = od.Quantity * od.UnitPrice
        <SPAN style="COLOR: blue">select new </SPAN><SPAN style="COLOR: #2b91af">OrderDescription </SPAN>{Product = p.ProductName, Quantity = od.Quantity, 
                     ShipperName = s.CompanyName, Total = total, UnitPrice=od.UnitPrice,
                     SupplierName = supplier.CompanyName};
    <SPAN style="COLOR: blue">return </SPAN>orderDetails;

}</PRE><A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"></A>
<P>This code joins 5 tables to grab order details and adds the target fields to the custom OrderDescription object.&nbsp; By using this code the SQL is created on the fly from LINQ expression trees and sent to the database so any changes to the query require changes to the code of course.&nbsp; For those that don't like working with stored procedures this certainly is the next best thing.</P>

<P>A better way of doing this that leverages relationships between objects defined in the LINQ to SQL data model is shown next (thanks to <A href="http://blogs.thinktecture.com/cnagel/archive/2008/02/18/415108.aspx" target=_blank>Christian Nagel</A>):</P>
<PRE class=code><SPAN style="COLOR: #2b91af">IEnumerable</SPAN>&lt;<SPAN style="COLOR: #2b91af">OrderDescription</SPAN>&gt; orderDetails =
  <SPAN style="COLOR: blue">from </SPAN>o <SPAN style="COLOR: blue">in </SPAN>db.Orders
  <SPAN style="COLOR: blue">where </SPAN>o.OrderID == orderID
  <SPAN style="COLOR: blue">from </SPAN>od <SPAN style="COLOR: blue">in </SPAN>o.OrderDetails
  <SPAN style="COLOR: blue">let </SPAN>total = od.Quantity * od.UnitPrice
  <SPAN style="COLOR: blue">select new </SPAN><SPAN style="COLOR: #2b91af">OrderDescription
  </SPAN>{
      Product = od.Product.ProductName,
      Quantity = od.Quantity,
      ShipperName = o.Shipper.CompanyName,
      Total = total,
      UnitPrice = od.UnitPrice,
      SupplierName = od.Product.Supplier.CompanyName
  };
<SPAN style="COLOR: blue">return </SPAN>orderDetails;</PRE><A href="http://11011.net/software/vspaste"></A>
<P><BR><STRONG><FONT size=4>Using Lambdas</FONT></STRONG></P>

<P>I mentioned earlier that I'm a big fan of lambdas when a particular query is reasonable.&nbsp; However, they can get out of control.&nbsp; The fairly straightforward LINQ query shown above gets pretty nasty when switching to lambdas since the joins require identifying the primary, foreign keys and fields to select.&nbsp; This is lambda overkill....there are too many =&gt; characters in there for me, but it matches up with the LINQ query shown above pretty well.</P>
<PRE class=code><SPAN style="COLOR: blue">public override </SPAN><SPAN style="COLOR: #2b91af">IEnumerable</SPAN>&lt;<SPAN style="COLOR: #2b91af">OrderDescription</SPAN>&gt; GetOrderDetails(<SPAN style="COLOR: blue">int </SPAN>orderID)
{
<SPAN style="COLOR: #2b91af">    NorthwindDataContext </SPAN>db = <SPAN style="COLOR: blue">this</SPAN>.DataContext;
      <SPAN style="COLOR: #2b91af">IEnumerable</SPAN>&lt;<SPAN style="COLOR: #2b91af">OrderDescription</SPAN>&gt; orderDetails =
        db.Orders.Where(order =&gt; order.OrderID == orderID).
        Join(db.Shippers, o =&gt; o.ShipVia, s =&gt; s.ShipperID, 
          (o, s) =&gt; <SPAN style="COLOR: blue">new </SPAN>{ o.OrderID, ShipCompanyName = s.CompanyName }).
        Join(db.OrderDetails, o =&gt; o.OrderID, od =&gt; od.OrderID, 
          (o, od) =&gt; <SPAN style="COLOR: blue">new </SPAN>{o.ShipCompanyName, od.ProductID, od.Quantity, od.UnitPrice }).
        Join(db.Products, od =&gt; od.ProductID, p =&gt; p.ProductID, 
          (OrderDetails, p) =&gt; <SPAN style="COLOR: blue">new </SPAN>{ OrderDetails, p.ProductName, p.SupplierID }).
        Join(db.Suppliers, p =&gt; p.SupplierID, s =&gt; s.SupplierID, 
          (OrderData, s) =&gt; <SPAN style="COLOR: blue">new </SPAN>{ OrderData, SupplierName = s.CompanyName}).
        Select(o =&gt; <SPAN style="COLOR: blue">new </SPAN><SPAN style="COLOR: #2b91af">OrderDescription
        </SPAN>{
            Product = o.OrderData.ProductName,
            Quantity = o.OrderData.OrderDetails.Quantity,
            ShipperName = o.OrderData.OrderDetails.ShipCompanyName,
            Total = o.OrderData.OrderDetails.Quantity * o.OrderData.OrderDetails.UnitPrice,
            UnitPrice = o.OrderData.OrderDetails.UnitPrice,
            SupplierName = o.SupplierName
        });
    <SPAN style="COLOR: blue">return </SPAN>orderDetails;
}</PRE><A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"></A>
<P>By leveraging relationships in the object model generated by the LINQ to SQL Designer you can simplify this query a lot.&nbsp; Here's an example of doing that (thanks to Dug for commenting and posting the refactored version):</P>
<PRE class=code><SPAN style="COLOR: blue">public override </SPAN><SPAN style="COLOR: #2b91af">IEnumerable</SPAN>&lt;<SPAN style="COLOR: #2b91af">OrderDescription</SPAN>&gt; GetOrderDetails(<SPAN style="COLOR: blue">int </SPAN>orderID)
{
<SPAN style="COLOR: #2b91af">       NorthwindDataContext </SPAN>db = <SPAN style="COLOR: blue">this</SPAN>.DataContext;

<SPAN style="COLOR: #2b91af">       IEnumerable</SPAN>&lt;<SPAN style="COLOR: #2b91af">OrderDescription</SPAN>&gt; orders =
         db.Orders.Where(order =&gt; order.OrderID == orderID).
         Join(db.OrderDetails, o =&gt; o.OrderID, od =&gt; od.OrderID,
         (o, od) =&gt; <SPAN style="COLOR: blue">new </SPAN>{ ShipCompanyName = o.Shipper.CompanyName, 
                          od.ProductID, 
                          ProductName = od.Product.ProductName, 
                          Quantity = od.Quantity, 
                          UnitPrice = od.UnitPrice, 
                          SupplierName = od.Product.Supplier.CompanyName }).

                         Select(o =&gt; <SPAN style="COLOR: blue">new </SPAN><SPAN style="COLOR: #2b91af">OrderDescription
                         </SPAN>{
                             Product = o.ProductName,
                             Quantity = o.Quantity,
                             ShipperName = o.ShipCompanyName,
                             Total = o.Quantity * o.UnitPrice,
                             UnitPrice = o.UnitPrice,
                             SupplierName = o.SupplierName
                         });
       <SPAN style="COLOR: blue">return </SPAN>orders;
}</PRE><A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"></A>
<P><STRONG><FONT size=4><BR>Using LINQ with Stored Procedures</FONT></STRONG></P>

<P>This is my favorite technique.&nbsp; While LINQ makes it easy to query against a database without embedding inline SQL into C# or VB.NET, using pure LINQ code still doesn't provide the same level of security that stored procedures can provide, requires that SQL be generated dynamically from LINQ expression trees and can complicate application maintenance down the road in my opinion.&nbsp; To call the stored procedure shown at the beginning of this post using LINQ to SQL techniques you can use the following code once the stored procedure has been drag and dropped onto the LINQ to SQL designer surface.&nbsp; This code is simple and easy to maintain.&nbsp; Plus, I can filter the results even more by using LINQ or by adding lambdas onto the ap_GetOrderDetailsByOrderID() method if needed.</P>
<PRE class=code><SPAN style="COLOR: blue">public override </SPAN><SPAN style="COLOR: #2b91af">IEnumerable</SPAN>&lt;<SPAN style="COLOR: #2b91af">OrderDescription</SPAN>&gt; GetOrderDetails(<SPAN style="COLOR: blue">int </SPAN>orderID)
{
    <SPAN style="COLOR: #2b91af">IEnumerable</SPAN>&lt;<SPAN style="COLOR: #2b91af">OrderDescription</SPAN>&gt; orderDetails = DataContext.ap_GetOrderDetailsByOrderID(orderID);
    <SPAN style="COLOR: blue">return </SPAN>orderDetails;
}</PRE>
<P>Ultimately it all comes down to personal preference.&nbsp; Having worked through many LINQ, lambda and stored procedure queries I'll be sticking with LINQ to SQL with sprocs since the code is squeaky clean.&nbsp; I have a few friends who prefer using inline LINQ as shown in the first example and we've argued the pros and cons of each technique back and forth.&nbsp; The beauty of it all is that we get to use what we want and have multiple options to choose from!</P>

<P>I'll post the demo code I've been working on soon so those who are interested in getting into LINQ, lambdas and LINQ with sprocs can see how each technique can be used in an n-tier application architecture. </P>

<P mce_keep="true">&nbsp;</P>

<DIV class=wlWriterSmartContent id=scid:0767317B-992E-4b12-91E0-4F059A8CECA8:3c67714e-ff28-4e98-873e-85dd8eac3449 style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px">del.icio.us Tags: <A href="http://del.icio.us/popular/LINQ" rel=tag>LINQ</A>,<A href="http://del.icio.us/popular/Lambdas" rel=tag>Lambdas</A>,<A href="http://del.icio.us/popular/Stored%20Procedures" rel=tag>Stored Procedures</A>,<A href="http://del.icio.us/popular/C#%203.0" rel=tag>C# 3.0</A></DIV>

<style type="text/css">
#pageHeaderWrapper { text-align: center;  width: 95%;  background-color: #FFFFFF; text-align: left; margin: 0 auto;border-top:1px solid black;border-left:1px solid black;border-right:1px solid black; }
#pageHeader {  }

#pageBodyWrapper { text-align: center;  width: 95%;  background-color: #FFFFFF; margin: 0 auto; border-bottom:1px solid black;border-left:1px solid black;border-right:1px solid black;}
#pageBody {width:86%;background-color: #FFFFFF; text-align: left; margin: 0 auto; }

#sidebarWrapper { }
#sidebar {float: right; width:20%;margin-top: 5px; overflow: hidden;
 }

#contentWrapper {  }
#content {  width:75%;margin-bottom: 60px; overflow: hidden;  }

#pageFooterWrapper { }
#pageFooter { font-size: 7pt; background: inherit; color: #C1C1C1; padding-top: 5px; margin-top: 25px; padding-top: 4px; width: 95%; }


.code {
    word-wrap:break-word;
    margin:8px;
    padding:8px;
    border:1px solid black;
    background-color:#efefef;
    font-family:Courier New;
    font-size:9pt;
}
</style>

<p>&nbsp;</p>

]]></content></entry><entry><title>Simplifying ASP.NET ListView Control Templates</title><category>ASP.NET</category><id>http://blogs.interfacett.com/dan-wahlins-blog/2008/2/16/simplifying-aspnet-listview-control-templates.html</id><link rel="alternate" type="text/html" href="http://blogs.interfacett.com/dan-wahlins-blog/2008/2/16/simplifying-aspnet-listview-control-templates.html"/><author><name>Dan Wahlin</name></author><published>2008-02-16T06:02:55Z</published><updated>2008-02-16T06:02:55Z</updated><content type="html" xml:lang="en-US"><![CDATA[<P>I've been working with the new ListView control in ASP.NET 3.5 combining it with LINQ and Lambda expressions and was finding myself duplicating a lot of code between ItemTemplate and AlternatingItemTemplate templates (I'll be posting the sample application that demonstrates using LINQ, Lambdas and Stored Procedures soon).&nbsp; The AlternatingItemTemplate contained the same code as the ItemTemplate except for a CSS class added to the first &lt;tr&gt; element to change the background color.&nbsp; Here's an example of both templates that were used initially:</P>
<PRE class=code><SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">ItemTemplate</SPAN><SPAN style="COLOR: blue">&gt;
    &lt;</SPAN><SPAN style="COLOR: #a31515">tr </SPAN><SPAN style="COLOR: red">class</SPAN><SPAN style="COLOR: blue">="even"</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td </SPAN><SPAN style="COLOR: red">class</SPAN><SPAN style="COLOR: blue">="tdControls"&gt;
            &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton </SPAN><SPAN style="COLOR: red">ID</SPAN><SPAN style="COLOR: blue">="EditButton" </SPAN><SPAN style="COLOR: red">CommandName</SPAN><SPAN style="COLOR: blue">="Edit" </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" <BR>              </SPAN><SPAN style="COLOR: red">Text</SPAN><SPAN style="COLOR: blue">="Edit"&gt;&lt;/</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton</SPAN><SPAN style="COLOR: blue">&gt;
            &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton </SPAN><SPAN style="COLOR: red">ID</SPAN><SPAN style="COLOR: blue">="DeleteButton"  <BR>              </SPAN><SPAN style="COLOR: red">OnClientClick</SPAN><SPAN style="COLOR: blue">="return confirm('Delete Record?');" <BR>              </SPAN><SPAN style="COLOR: red">CommandName</SPAN><SPAN style="COLOR: blue">="Delete" </SPAN><SPAN style="COLOR: red">CommandArgument</SPAN><SPAN style="COLOR: blue">='</SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("CustomerID")<SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">' <BR>              </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" </SPAN><SPAN style="COLOR: red">Text</SPAN><SPAN style="COLOR: blue">="Delete"&gt;&lt;/</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("CustomerID") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("CompanyName") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("ContactName") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("ContactTitle") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("Address") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("City") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("Country") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton </SPAN><SPAN style="COLOR: red">ID</SPAN><SPAN style="COLOR: blue">="lbOrders" </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" </SPAN><SPAN style="COLOR: red">Text</SPAN><SPAN style="COLOR: blue">="Orders" <BR>               </SPAN><SPAN style="COLOR: red">CommandName</SPAN><SPAN style="COLOR: blue">="ViewOrders" <BR>               </SPAN><SPAN style="COLOR: red">CommandArgument</SPAN><SPAN style="COLOR: blue">='</SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("CustomerID") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">' /&gt;
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
    &lt;/</SPAN><SPAN style="COLOR: #a31515">tr</SPAN><SPAN style="COLOR: blue">&gt;
    &lt;</SPAN><SPAN style="COLOR: #a31515">tr </SPAN><SPAN style="COLOR: red">id</SPAN><SPAN style="COLOR: blue">="trOrders" </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" </SPAN><SPAN style="COLOR: red">visible</SPAN><SPAN style="COLOR: blue">="false"&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;</SPAN><SPAN style="COLOR: red">&amp;nbsp;</SPAN><SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td </SPAN><SPAN style="COLOR: red">colspan</SPAN><SPAN style="COLOR: blue">="8"&gt;
            &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">GridView </SPAN><SPAN style="COLOR: red">id</SPAN><SPAN style="COLOR: blue">="gvOrders" </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" </SPAN><SPAN style="COLOR: red">AutoGenerateColumns</SPAN><SPAN style="COLOR: blue">="False" 
                </SPAN><SPAN style="COLOR: red">BackColor</SPAN><SPAN style="COLOR: blue">="White" </SPAN><SPAN style="COLOR: red">BorderColor</SPAN><SPAN style="COLOR: blue">="#999999" </SPAN><SPAN style="COLOR: red">BorderStyle</SPAN><SPAN style="COLOR: blue">="Solid" <BR>                </SPAN><SPAN style="COLOR: red">BorderWidth</SPAN><SPAN style="COLOR: blue">="1px" </SPAN><SPAN style="COLOR: red">CellPadding</SPAN><SPAN style="COLOR: blue">="3" </SPAN><SPAN style="COLOR: red">ForeColor</SPAN><SPAN style="COLOR: blue">="Black" 
                </SPAN><SPAN style="COLOR: red">GridLines</SPAN><SPAN style="COLOR: blue">="Vertical" </SPAN><SPAN style="COLOR: red">Width</SPAN><SPAN style="COLOR: blue">="500px" </SPAN><SPAN style="COLOR: red">EnableViewState</SPAN><SPAN style="COLOR: blue">="false"&gt;
                    &lt;</SPAN><SPAN style="COLOR: #a31515">FooterStyle </SPAN><SPAN style="COLOR: red">BackColor</SPAN><SPAN style="COLOR: blue">="#CCCCCC" /&gt;
                    &lt;</SPAN><SPAN style="COLOR: #a31515">Columns</SPAN><SPAN style="COLOR: blue">&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">BoundField </SPAN><SPAN style="COLOR: red">DataField</SPAN><SPAN style="COLOR: blue">="OrderID" </SPAN><SPAN style="COLOR: red">HeaderText</SPAN><SPAN style="COLOR: blue">="OrderID" 
                            </SPAN><SPAN style="COLOR: red">SortExpression</SPAN><SPAN style="COLOR: blue">="OrderID" /&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">BoundField </SPAN><SPAN style="COLOR: red">DataField</SPAN><SPAN style="COLOR: blue">="OrderDate" </SPAN><SPAN style="COLOR: red">HeaderText</SPAN><SPAN style="COLOR: blue">="OrderDate" 
                            </SPAN><SPAN style="COLOR: red">SortExpression</SPAN><SPAN style="COLOR: blue">="OrderDate" </SPAN><SPAN style="COLOR: red">HtmlEncode</SPAN><SPAN style="COLOR: blue">="false" <BR>                            </SPAN><SPAN style="COLOR: red">DataFormatString</SPAN><SPAN style="COLOR: blue">="{0:d}" /&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">BoundField </SPAN><SPAN style="COLOR: red">DataField</SPAN><SPAN style="COLOR: blue">="RequiredDate" <BR>                            </SPAN><SPAN style="COLOR: red">HeaderText</SPAN><SPAN style="COLOR: blue">="RequiredDate" 
                            </SPAN><SPAN style="COLOR: red">SortExpression</SPAN><SPAN style="COLOR: blue">="RequiredDate"  </SPAN><SPAN style="COLOR: red">HtmlEncode</SPAN><SPAN style="COLOR: blue">="false" <BR>                            </SPAN><SPAN style="COLOR: red">DataFormatString</SPAN><SPAN style="COLOR: blue">="{0:d}" /&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">BoundField </SPAN><SPAN style="COLOR: red">DataField</SPAN><SPAN style="COLOR: blue">="ShippedDate" <BR>                            </SPAN><SPAN style="COLOR: red">HeaderText</SPAN><SPAN style="COLOR: blue">="ShippedDate" 
                            </SPAN><SPAN style="COLOR: red">SortExpression</SPAN><SPAN style="COLOR: blue">="ShippedDate" </SPAN><SPAN style="COLOR: red">HtmlEncode</SPAN><SPAN style="COLOR: blue">="false" <BR>                            </SPAN><SPAN style="COLOR: red">DataFormatString</SPAN><SPAN style="COLOR: blue">="{0:d}" /&gt;
                    &lt;/</SPAN><SPAN style="COLOR: #a31515">Columns</SPAN><SPAN style="COLOR: blue">&gt;
                    &lt;</SPAN><SPAN style="COLOR: #a31515">AlternatingRowStyle </SPAN><SPAN style="COLOR: red">BackColor</SPAN><SPAN style="COLOR: blue">="#eaeaea" /&gt;                                        
             &lt;/</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">GridView</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
    &lt;/</SPAN><SPAN style="COLOR: #a31515">tr</SPAN><SPAN style="COLOR: blue">&gt;
&lt;/</SPAN><SPAN style="COLOR: #a31515">ItemTemplate<SPAN style="COLOR: blue">&gt;</SPAN></SPAN>
<SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">AlternatingItemTemplate</SPAN><SPAN style="COLOR: blue">&gt;
    &lt;</SPAN><SPAN style="COLOR: #a31515">tr </SPAN><SPAN style="COLOR: red">class</SPAN><SPAN style="COLOR: blue">="odd"</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td </SPAN><SPAN style="COLOR: red">class</SPAN><SPAN style="COLOR: blue">="tdControls"&gt;
            &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton </SPAN><SPAN style="COLOR: red">ID</SPAN><SPAN style="COLOR: blue">="EditButton" </SPAN><SPAN style="COLOR: red">CommandName</SPAN><SPAN style="COLOR: blue">="Edit" </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" <BR>              </SPAN><SPAN style="COLOR: red">Text</SPAN><SPAN style="COLOR: blue">="Edit"&gt;&lt;/</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton</SPAN><SPAN style="COLOR: blue">&gt;
            &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton </SPAN><SPAN style="COLOR: red">ID</SPAN><SPAN style="COLOR: blue">="DeleteButton"  <BR>              </SPAN><SPAN style="COLOR: red">OnClientClick</SPAN><SPAN style="COLOR: blue">="return confirm('Delete Record?');" <BR>              </SPAN><SPAN style="COLOR: red">CommandName</SPAN><SPAN style="COLOR: blue">="Delete" </SPAN><SPAN style="COLOR: red">CommandArgument</SPAN><SPAN style="COLOR: blue">='</SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("CustomerID")<SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">' <BR>              </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" </SPAN><SPAN style="COLOR: red">Text</SPAN><SPAN style="COLOR: blue">="Delete"&gt;&lt;/</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("CustomerID") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("CompanyName") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("ContactName") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("ContactTitle") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("Address") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("City") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("Country") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton </SPAN><SPAN style="COLOR: red">ID</SPAN><SPAN style="COLOR: blue">="lbOrders" </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" </SPAN><SPAN style="COLOR: red">Text</SPAN><SPAN style="COLOR: blue">="Orders" <BR>               </SPAN><SPAN style="COLOR: red">CommandName</SPAN><SPAN style="COLOR: blue">="ViewOrders" <BR>               </SPAN><SPAN style="COLOR: red">CommandArgument</SPAN><SPAN style="COLOR: blue">='</SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("CustomerID") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">' /&gt;
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
    &lt;/</SPAN><SPAN style="COLOR: #a31515">tr</SPAN><SPAN style="COLOR: blue">&gt;
    &lt;</SPAN><SPAN style="COLOR: #a31515">tr </SPAN><SPAN style="COLOR: red">id</SPAN><SPAN style="COLOR: blue">="trOrders" </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" </SPAN><SPAN style="COLOR: red">visible</SPAN><SPAN style="COLOR: blue">="false"&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;</SPAN><SPAN style="COLOR: red">&amp;nbsp;</SPAN><SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td </SPAN><SPAN style="COLOR: red">colspan</SPAN><SPAN style="COLOR: blue">="8"&gt;
            &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">GridView </SPAN><SPAN style="COLOR: red">id</SPAN><SPAN style="COLOR: blue">="gvOrders" </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" </SPAN><SPAN style="COLOR: red">AutoGenerateColumns</SPAN><SPAN style="COLOR: blue">="False" 
                </SPAN><SPAN style="COLOR: red">BackColor</SPAN><SPAN style="COLOR: blue">="White" </SPAN><SPAN style="COLOR: red">BorderColor</SPAN><SPAN style="COLOR: blue">="#999999" </SPAN><SPAN style="COLOR: red">BorderStyle</SPAN><SPAN style="COLOR: blue">="Solid" <BR>                </SPAN><SPAN style="COLOR: red">BorderWidth</SPAN><SPAN style="COLOR: blue">="1px" </SPAN><SPAN style="COLOR: red">CellPadding</SPAN><SPAN style="COLOR: blue">="3" </SPAN><SPAN style="COLOR: red">ForeColor</SPAN><SPAN style="COLOR: blue">="Black" 
                </SPAN><SPAN style="COLOR: red">GridLines</SPAN><SPAN style="COLOR: blue">="Vertical" </SPAN><SPAN style="COLOR: red">Width</SPAN><SPAN style="COLOR: blue">="500px" </SPAN><SPAN style="COLOR: red">EnableViewState</SPAN><SPAN style="COLOR: blue">="false"&gt;
                    &lt;</SPAN><SPAN style="COLOR: #a31515">FooterStyle </SPAN><SPAN style="COLOR: red">BackColor</SPAN><SPAN style="COLOR: blue">="#CCCCCC" /&gt;
                    &lt;</SPAN><SPAN style="COLOR: #a31515">Columns</SPAN><SPAN style="COLOR: blue">&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">BoundField </SPAN><SPAN style="COLOR: red">DataField</SPAN><SPAN style="COLOR: blue">="OrderID" </SPAN><SPAN style="COLOR: red">HeaderText</SPAN><SPAN style="COLOR: blue">="OrderID" 
                            </SPAN><SPAN style="COLOR: red">SortExpression</SPAN><SPAN style="COLOR: blue">="OrderID" /&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">BoundField </SPAN><SPAN style="COLOR: red">DataField</SPAN><SPAN style="COLOR: blue">="OrderDate" </SPAN><SPAN style="COLOR: red">HeaderText</SPAN><SPAN style="COLOR: blue">="OrderDate" 
                            </SPAN><SPAN style="COLOR: red">SortExpression</SPAN><SPAN style="COLOR: blue">="OrderDate" </SPAN><SPAN style="COLOR: red">HtmlEncode</SPAN><SPAN style="COLOR: blue">="false" <BR>                            </SPAN><SPAN style="COLOR: red">DataFormatString</SPAN><SPAN style="COLOR: blue">="{0:d}" /&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">BoundField </SPAN><SPAN style="COLOR: red">DataField</SPAN><SPAN style="COLOR: blue">="RequiredDate" <BR>                            </SPAN><SPAN style="COLOR: red">HeaderText</SPAN><SPAN style="COLOR: blue">="RequiredDate" 
                            </SPAN><SPAN style="COLOR: red">SortExpression</SPAN><SPAN style="COLOR: blue">="RequiredDate"  </SPAN><SPAN style="COLOR: red">HtmlEncode</SPAN><SPAN style="COLOR: blue">="false" <BR>                            </SPAN><SPAN style="COLOR: red">DataFormatString</SPAN><SPAN style="COLOR: blue">="{0:d}" /&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">BoundField </SPAN><SPAN style="COLOR: red">DataField</SPAN><SPAN style="COLOR: blue">="ShippedDate" <BR>                            </SPAN><SPAN style="COLOR: red">HeaderText</SPAN><SPAN style="COLOR: blue">="ShippedDate" 
                            </SPAN><SPAN style="COLOR: red">SortExpression</SPAN><SPAN style="COLOR: blue">="ShippedDate" </SPAN><SPAN style="COLOR: red">HtmlEncode</SPAN><SPAN style="COLOR: blue">="false" <BR>                            </SPAN><SPAN style="COLOR: red">DataFormatString</SPAN><SPAN style="COLOR: blue">="{0:d}" /&gt;
                    &lt;/</SPAN><SPAN style="COLOR: #a31515">Columns</SPAN><SPAN style="COLOR: blue">&gt;
                    &lt;</SPAN><SPAN style="COLOR: #a31515">AlternatingRowStyle </SPAN><SPAN style="COLOR: red">BackColor</SPAN><SPAN style="COLOR: blue">="#eaeaea" /&gt;                                        
             &lt;/</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">GridView</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
    &lt;/</SPAN><SPAN style="COLOR: #a31515">tr</SPAN><SPAN style="COLOR: blue">&gt;
&lt;/</SPAN><SPAN style="COLOR: #a31515">AlternatingItemTemplate</SPAN><SPAN style="COLOR: blue">&gt;</SPAN></PRE>
<P><BR>It seemed like a waste (and a maintenance headache) to have both templates duplicating the same code while only needing background color changes so I decided to adjust it by adding a little code into the first &lt;tr&gt; tag to dynamically assign the CSS class based upon odd or even rows. It calls the ListViewDataItem class's DataItemIndex property and applies a modulus operation to it.&nbsp; This isn't anything new of course (I've done the same type of thing for years with GridView and DataGrid controls), but it's a nice trick that can save a lot of duplicated code if you haven't seen it.</P>
<BR>
<PRE class=code><SPAN style="COLOR: blue">&lt;</SPAN><SPAN style="COLOR: #a31515">ItemTemplate</SPAN><SPAN style="COLOR: blue">&gt;
    </SPAN><SPAN style="COLOR: blue">&lt;<SPAN style="COLOR: #a31515">tr</SPAN> <SPAN style="COLOR: red">class</SPAN>='<SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># (Container.DataItemIndex % 2 == 0)?"even":"odd" <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN>'&gt;    <BR><SPAN style="COLOR: blue">        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt; </SPAN>   <BR></SPAN><SPAN style="COLOR: blue">            &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton </SPAN><SPAN style="COLOR: red">ID</SPAN><SPAN style="COLOR: blue">="EditButton" </SPAN><SPAN style="COLOR: red">CommandName</SPAN><SPAN style="COLOR: blue">="Edit" </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" <BR>              </SPAN><SPAN style="COLOR: red">Text</SPAN><SPAN style="COLOR: blue">="Edit"&gt;&lt;/</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton</SPAN><SPAN style="COLOR: blue">&gt;
            &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton </SPAN><SPAN style="COLOR: red">ID</SPAN><SPAN style="COLOR: blue">="DeleteButton"  <BR>              </SPAN><SPAN style="COLOR: red">OnClientClick</SPAN><SPAN style="COLOR: blue">="return confirm('Delete Record?');" <BR>              </SPAN><SPAN style="COLOR: red">CommandName</SPAN><SPAN style="COLOR: blue">="Delete" </SPAN><SPAN style="COLOR: red">CommandArgument</SPAN><SPAN style="COLOR: blue">='</SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("CustomerID")<SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">' <BR>              </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" </SPAN><SPAN style="COLOR: red">Text</SPAN><SPAN style="COLOR: blue">="Delete"&gt;&lt;/</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("CustomerID") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("CompanyName") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("ContactName") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("ContactTitle") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("Address") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("City") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            </SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("Country") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
            &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">LinkButton </SPAN><SPAN style="COLOR: red">ID</SPAN><SPAN style="COLOR: blue">="lbOrders" </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" </SPAN><SPAN style="COLOR: red">Text</SPAN><SPAN style="COLOR: blue">="Orders" <BR>               </SPAN><SPAN style="COLOR: red">CommandName</SPAN><SPAN style="COLOR: blue">="ViewOrders" <BR>               </SPAN><SPAN style="COLOR: red">CommandArgument</SPAN><SPAN style="COLOR: blue">='</SPAN><SPAN style="BACKGROUND: #ffee62">&lt;%</SPAN># Eval("CustomerID") <SPAN style="BACKGROUND: #ffee62">%&gt;</SPAN><SPAN style="COLOR: blue">' /&gt;
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
    &lt;/</SPAN><SPAN style="COLOR: #a31515">tr</SPAN><SPAN style="COLOR: blue">&gt;
    &lt;</SPAN><SPAN style="COLOR: #a31515">tr </SPAN><SPAN style="COLOR: red">id</SPAN><SPAN style="COLOR: blue">="trOrders" </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" </SPAN><SPAN style="COLOR: red">visible</SPAN><SPAN style="COLOR: blue">="false"&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;</SPAN><SPAN style="COLOR: red">&amp;nbsp;</SPAN><SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;</SPAN><SPAN style="COLOR: #a31515">td </SPAN><SPAN style="COLOR: red">colspan</SPAN><SPAN style="COLOR: blue">="8"&gt;
            &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">GridView </SPAN><SPAN style="COLOR: red">id</SPAN><SPAN style="COLOR: blue">="gvOrders" </SPAN><SPAN style="COLOR: red">runat</SPAN><SPAN style="COLOR: blue">="server" </SPAN><SPAN style="COLOR: red">AutoGenerateColumns</SPAN><SPAN style="COLOR: blue">="False" 
                </SPAN><SPAN style="COLOR: red">BackColor</SPAN><SPAN style="COLOR: blue">="White" </SPAN><SPAN style="COLOR: red">BorderColor</SPAN><SPAN style="COLOR: blue">="#999999" </SPAN><SPAN style="COLOR: red">BorderStyle</SPAN><SPAN style="COLOR: blue">="Solid" <BR>                </SPAN><SPAN style="COLOR: red">BorderWidth</SPAN><SPAN style="COLOR: blue">="1px" </SPAN><SPAN style="COLOR: red">CellPadding</SPAN><SPAN style="COLOR: blue">="3" </SPAN><SPAN style="COLOR: red">ForeColor</SPAN><SPAN style="COLOR: blue">="Black" 
                </SPAN><SPAN style="COLOR: red">GridLines</SPAN><SPAN style="COLOR: blue">="Vertical" </SPAN><SPAN style="COLOR: red">Width</SPAN><SPAN style="COLOR: blue">="500px" </SPAN><SPAN style="COLOR: red">EnableViewState</SPAN><SPAN style="COLOR: blue">="false"&gt;
                    &lt;</SPAN><SPAN style="COLOR: #a31515">FooterStyle </SPAN><SPAN style="COLOR: red">BackColor</SPAN><SPAN style="COLOR: blue">="#CCCCCC" /&gt;
                    &lt;</SPAN><SPAN style="COLOR: #a31515">Columns</SPAN><SPAN style="COLOR: blue">&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">BoundField </SPAN><SPAN style="COLOR: red">DataField</SPAN><SPAN style="COLOR: blue">="OrderID" </SPAN><SPAN style="COLOR: red">HeaderText</SPAN><SPAN style="COLOR: blue">="OrderID" 
                            </SPAN><SPAN style="COLOR: red">SortExpression</SPAN><SPAN style="COLOR: blue">="OrderID" /&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">BoundField </SPAN><SPAN style="COLOR: red">DataField</SPAN><SPAN style="COLOR: blue">="OrderDate" </SPAN><SPAN style="COLOR: red">HeaderText</SPAN><SPAN style="COLOR: blue">="OrderDate" 
                            </SPAN><SPAN style="COLOR: red">SortExpression</SPAN><SPAN style="COLOR: blue">="OrderDate" </SPAN><SPAN style="COLOR: red">HtmlEncode</SPAN><SPAN style="COLOR: blue">="false" <BR>                            </SPAN><SPAN style="COLOR: red">DataFormatString</SPAN><SPAN style="COLOR: blue">="{0:d}" /&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">BoundField </SPAN><SPAN style="COLOR: red">DataField</SPAN><SPAN style="COLOR: blue">="RequiredDate" <BR>                            </SPAN><SPAN style="COLOR: red">HeaderText</SPAN><SPAN style="COLOR: blue">="RequiredDate" 
                            </SPAN><SPAN style="COLOR: red">SortExpression</SPAN><SPAN style="COLOR: blue">="RequiredDate"  </SPAN><SPAN style="COLOR: red">HtmlEncode</SPAN><SPAN style="COLOR: blue">="false" <BR>                            </SPAN><SPAN style="COLOR: red">DataFormatString</SPAN><SPAN style="COLOR: blue">="{0:d}" /&gt;
                        &lt;</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">BoundField </SPAN><SPAN style="COLOR: red">DataField</SPAN><SPAN style="COLOR: blue">="ShippedDate" <BR>                            </SPAN><SPAN style="COLOR: red">HeaderText</SPAN><SPAN style="COLOR: blue">="ShippedDate" 
                            </SPAN><SPAN style="COLOR: red">SortExpression</SPAN><SPAN style="COLOR: blue">="ShippedDate" </SPAN><SPAN style="COLOR: red">HtmlEncode</SPAN><SPAN style="COLOR: blue">="false" <BR>                            </SPAN><SPAN style="COLOR: red">DataFormatString</SPAN><SPAN style="COLOR: blue">="{0:d}" /&gt;
                    &lt;/</SPAN><SPAN style="COLOR: #a31515">Columns</SPAN><SPAN style="COLOR: blue">&gt;
                    &lt;</SPAN><SPAN style="COLOR: #a31515">AlternatingRowStyle </SPAN><SPAN style="COLOR: red">BackColor</SPAN><SPAN style="COLOR: blue">="#eaeaea" /&gt;                                        
             &lt;/</SPAN><SPAN style="COLOR: #a31515">asp</SPAN><SPAN style="COLOR: blue">:</SPAN><SPAN style="COLOR: #a31515">GridView</SPAN><SPAN style="COLOR: blue">&gt;
        &lt;/</SPAN><SPAN style="COLOR: #a31515">td</SPAN><SPAN style="COLOR: blue">&gt;
    &lt;/</SPAN><SPAN style="COLOR: #a31515">tr</SPAN><SPAN style="COLOR: blue">&gt;
&lt;/</SPAN><SPAN style="COLOR: #a31515">ItemTemplate<SPAN style="COLOR: blue">&gt; </SPAN><BR></SPAN></PRE>
<DIV class=wlWriterSmartContent id=scid:0767317B-992E-4b12-91E0-4F059A8CECA8:836d3938-b413-4258-8b1d-29dd39d3a59f style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px">del.icio.us Tags: <A href="http://del.icio.us/popular/ASP.NET" rel=tag mce_href="http://del.icio.us/popular/ASP.NET">ASP.NET</A>,<A href="http://del.icio.us/popular/ListView" rel=tag mce_href="http://del.icio.us/popular/ListView">ListView</A>,<A href="http://del.icio.us/popular/Templates" rel=tag mce_href="http://del.icio.us/popular/Templates">Templates</A></DIV>


<style type="text/css">
#pageHeaderWrapper { text-align: center;  width: 95%;  background-color: #FFFFFF; text-align: left; margin: 0 auto;border-top:1px solid black;border-left:1px solid black;border-right:1px solid black; }
#pageHeader {  }

#pageBodyWrapper { text-align: center;  width: 95%;  background-color: #FFFFFF; margin: 0 auto; border-bottom:1px solid black;border-left:1px solid black;border-right:1px solid black;}
#pageBody {width:86%;background-color: #FFFFFF; text-align: left; margin: 0 auto; }

#sidebarWrapper { }
#sidebar {float: right; width:20%;margin-top: 5px; overflow: hidden;
 }

#contentWrapper {  }
#content {  width:75%;margin-bottom: 60px; overflow: hidden;  }

#pageFooterWrapper { }
#pageFooter { font-size: 7pt; background: inherit; color: #C1C1C1; padding-top: 5px; margin-top: 25px; padding-top: 4px; width: 95%; }


.code {
    word-wrap:break-word;
    margin:8px;
    padding:8px;
    border:1px solid black;
    background-color:#efefef;
    font-family:Courier New;
    font-size:9pt;
}
</style>

<p>&nbsp;</p>
]]></content></entry><entry><title>My Latest Silverlight Articles</title><id>http://blogs.interfacett.com/dan-wahlins-blog/2008/2/6/my-latest-silverlight-articles.html</id><link rel="alternate" type="text/html" href="http://blogs.interfacett.com/dan-wahlins-blog/2008/2/6/my-latest-silverlight-articles.html"/><author><name>Dan Wahlin</name></author><published>2008-02-06T03:22:33Z</published><updated>2008-02-06T03:22:33Z</updated><content type="html" xml:lang="en-US"><![CDATA[<p>Over the past few months I've been writing articles for the <a href="http://www.ftponline.com/" target="_blank"><u><font style="color: #0066cc" color="#0066cc">.NET Insight</font></u></a> insight newsletter covering various ASP.NET AJAX concepts.&nbsp; You can <a href="http://weblogs.asp.net/dwahlin/archive/2007/09/18/latest-asp-net-ajax-articles.aspx" target="_blank"><u><font style="color: #0066cc" color="#0066cc">read those article here</font></u></a>.&nbsp; I've wrapped up that series and have started writing about Silverlight 1.0.&nbsp; Each week a new article will be published and I'll update them here so check back.&nbsp; The articles are designed to be focused and concise and get straight to the topic without a lot of fluff.&nbsp;&nbsp;</p><ul><li><div><a href="http://www.ftponline.com/channels/net/2007_10/dwahlin/" target="_blank"><font style="color: #0066cc" color="#0066cc"><u>Getting Started with Silverlight</u></font></a></div></li><li><div><a href="http://www.ftponline.com/channels/net/2007_10/dwahlin2/" target="_blank"><font style="color: #0066cc" color="#0066cc"><u>Using Microsoft's Silverlight Control in a Web Site</u></font></a></div></li><li><div><a href="http://www.ftponline.com/channels/net/2007_10/dwahlin3/" target="_blank"><font style="color: #0066cc" color="#0066cc"><u>Understanding Silverlight's createObject and createObjectEx Methods</u></font></a></div></li><li><div><a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2374" target="_blank"><font style="color: #800080" color="#800080"><u>Silverlight XAML Primer 1: Exploring Canvases</u></font></a></div></li><li><div><a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2402" target="_blank"><font style="color: #800080" color="#800080"><u>Silverlight XAML Primer 2: Rectangles, Ellipses, Lines and Text</u></font></a></div></li><li><div><a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2409" target="_blank"><u><font style="color: #800080" color="#800080">Silverlight XAML Primer 3: Working with Image Brushes</font></u></a></div></li><li><div><a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2417" target="_blank"><u><font style="color: #0066cc" color="#0066cc">Silverlight XAML Primer 4: Working with Linear Gradients</font></u></a>&nbsp;</div></li><li><div><a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2449" target="_blank"><u><font style="color: #800080" color="#800080">Silverlight XAML Primer 5: Working with Radial Gradients</font></u></a>&nbsp;</div></li><li><div><a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2455" target="_blank"><font style="color: #800080" color="#800080"><u>Silverlight XAML Primer 6: Using Inline XAML with Silverlight</u></font></a></div></li><li><div><a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2474" target="_blank"><u><font style="color: #800080" color="#800080">Silverlight XAML Primer 7: Embedding Media into Silverlight</font></u></a>&nbsp;</div></li><li><div><a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2488" target="_blank"><u><font style="color: #800080" color="#800080">Silverlight XAML Primer 8: Working with Events</font></u></a>&nbsp;</div></li><li><div><a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2514" target="_blank"><u><font style="color: #800080" color="#800080">Silverlight XAML Primer 9: Using the Silverlight Downloader Object</font></u></a> </div></li><li><div><a href="http://www.ddj.com/windows/206901111?cid=RSSfeed_DDJ_All" target="_blank"><u><font style="color: #800080" color="#800080">Working with Events in Silverlight</font></u></a> (New!)</div></li><li><div><a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2527" target="_blank"><u><font style="color: #800080" color="#800080">Silverlight XAML Primer 10: Creating a Silverlight Downloader Progress Bar</font></u></a></div></li><div><li><div><a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2530" target="_blank"><u><font style="color: #800080" color="#800080">Silverlight XAML Primer 11: Getting Started with Animations</font></u></a>&nbsp;(New!)</div></li><li><div><a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2546" target="_blank"><u><font style="color: #0066cc" color="#0066cc">Introducing Silverlight 2.0</font></u></a> (New!)<br /></div></li></div></ul>]]></content></entry><entry><title>Introducing Visual Studio 2008 Course</title><id>http://blogs.interfacett.com/dan-wahlins-blog/2008/1/31/introducing-visual-studio-2008-course.html</id><link rel="alternate" type="text/html" href="http://blogs.interfacett.com/dan-wahlins-blog/2008/1/31/introducing-visual-studio-2008-course.html"/><author><name>Dan Wahlin</name></author><published>2008-01-31T01:09:00Z</published><updated>2008-01-31T01:09:00Z</updated><content type="html" xml:lang="en-US"><![CDATA[<p>Thanks to everyone that attended the Visual Studio 2008 course yesterday.&nbsp; It was a lot of fun talking about all of the new stuff available in VS 2008 and .NET 3.5 and hearing the different projects people are working on.&nbsp; As promised, here's the lab code from the course:</p><p><a href="http://www.xmlforasp.net/LabFiles/VS2008/VisualStudio2008LabFiles.zip">http://www.xmlforasp.net/LabFiles/VS2008/VisualStudio2008LabFiles.zip</a></p><p>&nbsp;</p>]]></content></entry></feed>