<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PeterKellner.net &#187; web</title>
	<atom:link href="http://peterkellner.net/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://peterkellner.net</link>
	<description>Microsoft Focused, JavaScript,HTML5 (ExtJS, SenchaTouch &#38; Windows 8 Metro)</description>
	<lastBuildDate>Fri, 11 May 2012 16:43:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>vaasnet, Awesome First Experience.  Need a VM Now, for just 2 hours?</title>
		<link>http://peterkellner.net/2012/01/19/vaasnet-awesome-first-experience-need-a-vm-now-for-just-2-hours/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=vaasnet-awesome-first-experience-need-a-vm-now-for-just-2-hours</link>
		<comments>http://peterkellner.net/2012/01/19/vaasnet-awesome-first-experience-need-a-vm-now-for-just-2-hours/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 00:09:50 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[hosting]]></category>
		<category><![CDATA[VPS]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2012/01/19/vaasnet-awesome-first-experience-need-a-vm-now-for-just-2-hours/</guid>
		<description><![CDATA[&#160;
I’ve known about vaasnet for quite a while.&#160; Basically, vaasnet is a way to almost instantly (OK, it took about 4 seconds to come up) grab a fresh VM (currently 99 cents an hour), do a bunch of stuff and go away.&#160; My bunch of stuff was I need to download a bittorrent file that [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p>I’ve known about <a href="http://www.vaasnet.com/">vaasnet</a> for quite a while.&#160; Basically, <a href="http://www.vaasnet.com/">vaasnet</a> is a way to almost instantly (OK, it took about 4 seconds to come up) grab a fresh VM (currently 99 cents an hour), do a bunch of stuff and go away.&#160; My bunch of stuff was I need to download a bittorrent file that was about 5 gig and I know if I do it from either home or over my hotspot, bad things will happen.&#160; If I do it at home, <a href="http://xfinity.comcast.net/?">Comcast</a> will send me a letter accusing me of stealing something, and if I use my <a href="http://www.verizonwireless.com/b2c/index.html">Verizon</a> hotspot, well, it’s a 5 gig per month plan.&#160; You do the math.</p>
<p>Back to vaasnet.&#160; Here is my experience today:</p>
<ol>
<li>30 seconds to put my credit card it</li>
<li>4 seconds to boot a general purpose workstation</li>
<li>5 seconds to RDP into it</li>
<li>2 minutes to download bit torrent</li>
<li>35 minutes to have bit torrent download a 5 gig file!</li>
<li>35 minutes to have bit torrent download a 5 gig file (had to say it twice)</li>
<li>1 minute to transfer the file to my <a href="http://www.orcsweb.com/">ORCSWeb</a> server I already have</li>
<li>$1.70 billed to my credit card.</li>
<li>OMG!</li>
</ol>
<p>I think that about says it all.&#160; OK, maybe not it all.</p>
<p>I’ll be back!</p>
<p>OK, now that says it all.</p>
<p>&#160;</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/01/image11.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/01/image_thumb9.png" width="501" height="429" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2012/01/19/vaasnet-awesome-first-experience-need-a-vm-now-for-just-2-hours/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SqlAzure and a Best Practices way to deal with the Required Retries on Connections</title>
		<link>http://peterkellner.net/2011/01/21/sqlazure-connection-retry-problem-using-best-practices/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sqlazure-connection-retry-problem-using-best-practices</link>
		<comments>http://peterkellner.net/2011/01/21/sqlazure-connection-retry-problem-using-best-practices/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 22:24:44 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 4.0]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Connection]]></category>
		<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[SqlAzure]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Web.Config]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2011/01/21/sqlazure-connection-retry-problem-using-best-practices/</guid>
		<description><![CDATA[Introduction
If you’ve started using SqlAzure for your SqlServer with your Azure application, you’ve probably discovered that you get a reasonable number of connection failures.&#160; The advice from the Azure team is add retry logic to all your connections to SqlAzure. There is a long discussion posted by the Azure team here.
The key paragraph states the [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>If you’ve started using <a href="http://msdn.microsoft.com/en-us/library/ee336279.aspx">SqlAzure</a> for your <a href="http://www.microsoft.com/sqlserver/2008/en/us/r2.aspx">SqlServer</a> with your Azure application, you’ve probably discovered that you get a reasonable number of <a href="http://msdn.microsoft.com/en-us/library/aa175395(v=sql.80).aspx">connection</a> failures.&#160; The advice from the Azure team is add retry logic to all your connections to SqlAzure. There is a long discussion posted by the Azure team <a href="http://blogs.msdn.com/b/bartr/archive/2010/06/18/sql-azure-connection-retry.aspx?utm_source=feedburner&amp;utm_medium=twitter&amp;utm_campaign=Feed%3A+Microsoft%2FMSDN-Blogs+(MSDN+Blogs)">here</a>.</p>
<p>The key paragraph states the problem as follows:</p>
<blockquote><p><strong>The Problem       <br /></strong>One of the things that SQL Azure does to deliver high availability is it sometimes closes <a href="http://msdn.microsoft.com/en-us/library/ee336245.aspx">connections</a>. SQL Azure does some pretty cool stuff under the covers to minimize the impact, but this is a key difference in SQL Azure development vs. SQL Server development.</p>
</blockquote>
<p>Basically, what this means is that you must be able to deal with connections failing when you call SqlAzure.&#160; Something that all of probably should have been doing forever, but because most of the time SqlServer is running on your local LAN and the likelihood if a connection failing was next to zero unless something else was going terribly wrong.&#160; Certainly not something we had to do on regular basis.&#160; To emphasize that even more, most of the controls built into asp.net that open connections to sqlserver don’t even do this and that’s from Microsoft itself.</p>
<p>The solution proposed in the thread mentioned above basically has you add tons of code to everyplace you access a connection object.&#160; Personally, I don’t like that because I have hundreds if not thousands of places I open connections and inserting tens of thousands of lines of extra new untested code is a little scary.</p>
<p>So, what to do?</p>
<p>Fortunately, another team at Microsoft, known as the <a href="http://blogs.msdn.com/b/appfabriccat">Windows Server AppFabric Customer Advisory Team</a> published a general purpose solution using Extension Methods and some darn clever coding wrote a <a href="http://blogs.msdn.com/b/appfabriccat/archive/2010/12/11/sql-azure-and-entity-framework-connection-fault-handling.aspx">great article and published code</a> including <a href="http://blogs.msdn.com/b/appfabriccat/archive/2010/10/28/best-practices-for-handling-transient-conditions-in-sql-azure-client-applications.aspx">azure examples</a> that solves this problem very elegantly without requiring a lot of changes to your existing code base.</p>
<p>In this article I plan on giving an example and publishing a sample project that uses this code with SqlAzure to solve the connection retry problem.&#160; My goal here is not to simply restate what they published but to simply have a very simple concrete example of using their library.</p>
<p>  <span id="more-1429"></span><br />
<h2>Design Goal</h2>
<p>We have two goals.</p>
<ol>
<li>
<div align="left">Change as little code as possible</div>
</li>
<li>
<div align="left">Log Connection Errors when they happen With Locations</div>
</li>
<li>
<div align="left">Make sure not to trap errors that are NOT connection related such as bad column names</div>
</li>
</ol>
<p align="left">&#160;</p>
<h2 align="left">Incorrect Code</h2>
<p align="left">So, this is what the original code looks like that will fail because it does not have connection retry logic:</p>
<p align="left">&#160;</p>
<div id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">int</span> UsersIdFromUserNameNoConnectionRetry(<span style="color: #0000ff">string</span> userName){    var retUsersId = 0;    <span style="color: #0000ff">const</span> <span style="color: #0000ff">string</span> sql =        <span style="color: #006080">@&quot;SELECT Id FROM Users            WHERE Username = @Username&quot;</span>;

    <span style="color: #0000ff">using</span> (var sqlConnection = <span style="color: #0000ff">new</span> SqlConnection(            ConfigurationManager.ConnectionStrings[<span style="color: #006080">&quot;CRStorageWebConnectionString&quot;</span>].            ConnectionString))    {        sqlConnection.Open();        <span style="color: #0000ff">using</span> (var sqlCommand = <span style="color: #0000ff">new</span> SqlCommand(sql, sqlConnection))        {            sqlCommand.Parameters.Add(<span style="color: #006080">&quot;@Username&quot;</span>, SqlDbType.NVarChar).Value = userName;            <span style="color: #0000ff">using</span> (var reader = sqlCommand.ExecuteReader())            {                <span style="color: #0000ff">while</span> (reader.Read())                {                    retUsersId = reader.IsDBNull(0) ? 0 : reader.GetInt32(0);                }            }        }    }    <span style="color: #0000ff">return</span> retUsersId;}</pre>
<p></div>
<p align="left">So, if there is a connection, an exception will get thrown and will need to be caught, but then the method will not have done it’s job.</p>
<p align="left">&#160;</p>
<h2 align="left">Correct Code With Retries</h2>
<p align="left">So, now take a look at the revised code after the library is setup and used.&#160; The setup is non-trivial, but you just have to do that once and then you can simply fix all your other code with very few changes.&#160; Below is the new code with connection retry logic built in.</p>
<p align="left">&#160;</p>
<div id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">int</span> UsersIdFromUserName(<span style="color: #0000ff">string</span> userName){    var retUsersId = 0;    <span style="color: #0000ff">const</span> <span style="color: #0000ff">string</span> sql =        <span style="color: #006080">@&quot;SELECT Id FROM Users            WHERE Username = @Username&quot;</span>;

    <span style="color: #0000ff">using</span> (var sqlConnection =        <span style="color: #0000ff">new</span> ReliableSqlConnection(            ConfigurationManager.ConnectionStrings[<span style="color: #006080">&quot;CRStorageWebConnectionString&quot;</span>].            ConnectionString,            <span style="color: #0000ff">new</span> RetryUtils(<span style="color: #006080">&quot;&quot;</span>, <span style="color: #006080">&quot;UsersIdFromUserName&quot;</span>).GetRetryPolicy()))    {        sqlConnection.Open();        <span style="color: #0000ff">using</span> (var sqlCommand = <span style="color: #0000ff">new</span> SqlCommand(sql, sqlConnection.Current))        {            sqlCommand.Parameters.Add(<span style="color: #006080">&quot;@Username&quot;</span>, SqlDbType.NVarChar).Value = userName;            <span style="color: #0000ff">using</span> (var reader = sqlCommand.ExecuteReader())            {                <span style="color: #0000ff">while</span> (reader.Read())                {                    retUsersId = reader.IsDBNull(0) ? 0 : reader.GetInt32(0);                }            }        }    }    <span style="color: #0000ff">return</span> retUsersId;}</pre>
</div>
<div>&#160;</div>
<div>There are basically two changes.&#160; </div>
<div>&#160;</div>
<ol>
<li>The first is instead of create an SqlConnection(…) we are creating a ReliableSqlConnection(…).&#160; The ReliableSqlConnection takes an extra parameter which basically wraps the retry logic used, as well as labelling this connection so when it fails, it gets logged.&#160; In the log, there will be the comment “UsersIdFromUserName” so we know what method threw the retry.</li>
<li>The second is slight change we when we create the SqlCommand, we have to add the property .Current to it so we know we are talking about the currently executing connection.&#160; There may be a default way to handle this but I could not figure it out.</li>
</ol>
<div>That’s it!&#160; you are new connection safe for retrying failed connections.</div>
<div>&#160;</div>
<h2>The Setup Pieces</h2>
<div>&#160;</div>
<div>First, download the library from the article mention above which can be found here in <a href="http://code.msdn.microsoft.com/">Microsoft’s Code Gallery</a></div>
<div>&#160;</div>
<div><a title="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=appfabriccat&amp;DownloadId=14007" href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=appfabriccat&amp;DownloadId=14007">http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=appfabriccat&amp;DownloadId=14007</a></div>
<div>&#160;</div>
<p>The project has all kinds of stuff in it that build quite nicely, run and test under vs2010.&#160; All I’m interested in is the ado.net piece and the retry logic around that.&#160; I actually used the 1.2 version, however I now see there is a 1.3 version with some improvements.&#160; I would post my project but I don’t want to post it with old code so I’ll just tell you the steps I went through so you can do the same.</p>
<h3>Build the class library</h3>
<p>Compile the project and make sure you have the dll from the library lincluded in your actual visual studio project.&#160; The library you want is Microsoft.AppFabricCAT.Samples.Azure.TransientFaultHandling.</p>
<p>&#160;</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/SqlAzure-and-a-Best-Practices-way-to-dea_E1CC/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/SqlAzure-and-a-Best-Practices-way-to-dea_E1CC/image_thumb.png" width="347" height="243" /></a></p>
<p>&#160;</p>
<h3>Update Your Web.config</h3>
<p>Add the config section below to your web.config file.</p>
<div id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">configSections</span><span style="color: #0000ff">&gt;</span>    <span style="color: #0000ff">&lt;</span><span style="color: #800000">section</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;RetryPolicyConfiguration&quot;</span>          <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;Microsoft.AppFabricCAT.Samples.Azure.TransientFaultHandling.Configuration.RetryPolicyConfigurationSettings,            Microsoft.AppFabricCAT.Samples.Azure.TransientFaultHandling&quot;</span> <span style="color: #0000ff">/&gt;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">configSections</span><span style="color: #0000ff">&gt;</span>

<span style="color: #0000ff">&lt;</span><span style="color: #800000">RetryPolicyConfiguration</span> <span style="color: #ff0000">defaultPolicy</span><span style="color: #0000ff">=&quot;FixedIntervalDefault&quot;</span> <span style="color: #ff0000">defaultSqlConnectionPolicy</span><span style="color: #0000ff">=&quot;FixedIntervalDefault&quot;</span>          <span style="color: #ff0000">defaultSqlCommandPolicy</span><span style="color: #0000ff">=&quot;FixedIntervalDefault&quot;</span> <span style="color: #ff0000">defaultStoragePolicy</span><span style="color: #0000ff">=&quot;IncrementalIntervalDefault&quot;</span>          <span style="color: #ff0000">defaultCommunicationPolicy</span><span style="color: #0000ff">=&quot;IncrementalIntervalDefault&quot;</span><span style="color: #0000ff">&gt;</span>    <span style="color: #0000ff">&lt;</span><span style="color: #800000">add</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;FixedIntervalDefault&quot;</span> <span style="color: #ff0000">maxRetryCount</span><span style="color: #0000ff">=&quot;10&quot;</span> <span style="color: #ff0000">retryInterval</span><span style="color: #0000ff">=&quot;100&quot;</span> <span style="color: #0000ff">/&gt;</span>    <span style="color: #0000ff">&lt;</span><span style="color: #800000">add</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;IncrementalIntervalDefault&quot;</span> <span style="color: #ff0000">maxRetryCount</span><span style="color: #0000ff">=&quot;10&quot;</span> <span style="color: #ff0000">retryInterval</span><span style="color: #0000ff">=&quot;100&quot;</span> <span style="color: #ff0000">retryIncrement</span><span style="color: #0000ff">=&quot;50&quot;</span> <span style="color: #0000ff">/&gt;</span>    <span style="color: #0000ff">&lt;</span><span style="color: #800000">add</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;ExponentialIntervalDefault&quot;</span> <span style="color: #ff0000">maxRetryCount</span><span style="color: #0000ff">=&quot;10&quot;</span> <span style="color: #ff0000">minBackoff</span><span style="color: #0000ff">=&quot;100&quot;</span> <span style="color: #ff0000">maxBackoff</span><span style="color: #0000ff">=&quot;1000&quot;</span> <span style="color: #ff0000">deltaBackoff</span><span style="color: #0000ff">=&quot;100&quot;</span> <span style="color: #0000ff">/&gt;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">RetryPolicyConfiguration</span><span style="color: #0000ff">&gt;</span></pre>
<p></div>
<p>This defines a new section in your web.config, then implements it with several different retry policies include a default one which seems quite reasonable to me.</p>
<p>If you remember, in the implementation section above, we used a public class called RetryUtils.&#160; This class is actually one I invented as a convenience class to minimize the code I have to update on each use of the ReliableConnection Object.&#160; Just to refresh your memory, the implementation is this:</p>
<div id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">using</span> (var sqlConnection =                <span style="color: #0000ff">new</span> ReliableSqlConnection(                    ConfigurationManager.ConnectionStrings[<span style="color: #006080">&quot;CRStorageWebConnectionString&quot;</span>].                    ConnectionString,                    <span style="color: #0000ff">new</span> RetryUtils(<span style="color: #006080">&quot;&quot;</span>, <span style="color: #006080">&quot;UsersIdFromUserName&quot;</span>).GetRetryPolicy()))</pre>
<p></div>
<p>The actual code fo rthe class RetryUtils is below here.&#160; You’ll have to stick this someplace in your project.</p>
<div>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">namespace</span> Utils{

    <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> RetryUtils    {        <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Username { get; set; }        <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> CallersName { get; set; }

        <span style="color: #0000ff">public</span> RetryUtils(<span style="color: #0000ff">string</span> username, <span style="color: #0000ff">string</span> callersName)        {            Username = username;            CallersName = callersName;        }

        <span style="color: #0000ff">public</span> RetryUtils()        {            Username = <span style="color: #0000ff">string</span>.Empty;            CallersName = <span style="color: #0000ff">string</span>.Empty;        }

        <span style="color: #0000ff">public</span> RetryPolicy&lt;SqlAzureTransientErrorDetectionStrategy&gt; GetRetryPolicy()        {            var retryPolicy = <span style="color: #0000ff">new</span> RetryPolicy&lt;SqlAzureTransientErrorDetectionStrategy&gt;                 (RetryPolicy.DefaultClientRetryCount, RetryPolicy.DefaultMinBackoff,                  RetryPolicy.DefaultMaxBackoff,                  RetryPolicy.DefaultClientBackoff);

            retryPolicy.RetryOccurred += RetryPolicyRetryOccurred;

            <span style="color: #0000ff">return</span> retryPolicy;        }

        <span style="color: #0000ff">void</span> RetryPolicyRetryOccurred(<span style="color: #0000ff">int</span> currentRetryCount, Exception lastException, TimeSpan delay)        {            GeneralUtils.GetLog4NetAllDataContext().AddLog4NetAll(<span style="color: #0000ff">new</span> Log4NetAll                                                    {                                                        Date = DateTime.UtcNow,                                                        EllapsedTime = 0,                                                        ExceptionStackTrace = lastException.StackTrace,                                                        Message = <span style="color: #006080">&quot;RetryCount: &quot;</span> + currentRetryCount + <span style="color: #006080">&quot; delay: &quot;</span> + delay.Seconds,                                                        ExceptionMessage = lastException.Message,                                                        Logger = <span style="color: #006080">&quot;&quot;</span>,                                                        Level = <span style="color: #006080">&quot;Error&quot;</span>,                                                        UserName = Username,                                                        PartitionKey = Username,                                                        RowKey = Guid.NewGuid().ToString()                                                    });        }           }}</pre>
</div>
<div>This code actually has the nice callback delegate that does the logging when a retry actually occurs.&#160; I’m not including my implementation of GeneralUtils.GetLog4NetAllDataContext().AddLog4NetAll, but you can pretty much guess what it does.&#160; It simply logs the retry with all the details of what happened.&#160; My implementation sticks this in an Azure Table, but that’s really for another post.</div>
<div>&#160;</div>
<h2>Non Connection Related Errors</h2>
<div>&#160;</div>
<div>Remember, our second design criteria is that we should only fail on errors that are connection related and not things like data column not found.&#160; With no additional work, this library takes care of this for us.&#160; Actually, in the release notes for the 1.3 release (which I have not used yet) say they have improved that feature by adding additional codes not to fail on.&#160; That is, the last thing you want is your code spending 5 minutes retrying on a problem you’d just like reported immediately. </div>
<div>&#160;</div>
<div>Keep in mind that the library we are using here is a general purpose retry library not designed just for use with ado.net.&#160; The team has provided us with examples using LINQ2SQL, EntityFramework and other technologies.&#160; I spent&#160; a little time reading about using those other technologies but did not get far enough to blog about it.&#160; My current SqlAzure implementation uses 100% ado.net because performance is critical to me and neither EF or LINQ2SQL are quite up to my task yet.</div>
<div>&#160;</div>
<h2>Conclusions</h2>
<div>&#160;</div>
<div>So basically, that’s it!&#160; You know have the tools to implement very nice retry logic in your ado.net code so Azure will not fail on “normal” connection failures.&#160; I suggest that if you are using SqlAzure, you implement this as soon as possible so your code will be solid going forward.</div>
<div>&#160;</div>
<div>Thanks for reading!</div>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2011/01/21/sqlazure-connection-retry-problem-using-best-practices/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Introduction To Using RIA Services In Silverlight (Article 1 of 7)</title>
		<link>http://peterkellner.net/2010/01/20/riaservices-silverlight-4-tutorial-svcc-part1of7-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=riaservices-silverlight-4-tutorial-svcc-part1of7-introduction</link>
		<comments>http://peterkellner.net/2010/01/20/riaservices-silverlight-4-tutorial-svcc-part1of7-introduction/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 19:12:09 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[RIA Services]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Speaking]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[VS2010]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://peterkellner.net/?p=405</guid>
		<description><![CDATA[This series of video presentations goes through the process of building a Speaker and Sessions Viewer for Silicon Valley Code Camp’s data using Silverlight 4 and RIA Services (Using Visual Studio 2010 Beta 2).&#160; It starts with a brief introduction of RIA Services and is followed by screen casts and blog posts the parallel each [...]]]></description>
			<content:encoded><![CDATA[<p>This series of video presentations goes through the process of building a Speaker and Sessions Viewer for Silicon Valley Code Camp’s data using <a href="http://blogs.msdn.com/brada/">Silverlight 4</a> and <a href="http://silverlight.net/getstarted/riaservices/">RIA Services</a> (Using Visual Studio 2010 Beta 2).&#160; It starts with a brief introduction of RIA Services and is followed by screen casts and blog posts the parallel each screen cast.</p>
<p>The actual <a href="http://peterkellner.net/2010/01/13/baynet-presentation-riaservices/">presentation</a> was done at the Microsoft office in San Francisco. </p>
<p> <span id="more-405"></span><br />
<table width="90%">
<tbody>
<tr>
<td width="70">&#160;</td>
<td>Title Of Each Article</td>
<td style="width: 100px" width="150">Video Included With Each Post</td>
</tr>
<tr>
<td width="70">Part 1</td>
<td><a href="http://peterkellner.net/2010/01/20/riaservices-silverlight-4-tutorial-svcc-part1of7-introduction/">Introduction To RIA Services In Silverlight (This Article)</a></td>
<td style="width: 100px" width="150">7 Minutes</td>
</tr>
<tr>
<td width="70">Part 2</td>
<td><a href="http://peterkellner.net/2010/01/25/basic-ria-services-and-datagrid-with-vs-2010-tooling-article-2-of-7/">Basic RIA Services And DataGrid With&#160; VS 2010 Tooling</a></td>
<td style="width: 100px" width="150">14 Minutes</td>
</tr>
<tr>
<td width="70">Part 3</td>
<td><a href="http://peterkellner.net/2010/01/23/adding-a-datagrid-with-connect-the-dots-databinding-in-vs-2010-article-3-of-7/">Adding A DataGrid With Connect The Dots DataBinding in VS 2010</a></td>
<td style="width: 100px" width="150">13 Minutes</td>
</tr>
<tr>
<td width="70">Part 4</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-a-navigation-page-to-a-silverlight-business-application-template-article-4-of-7/">Adding a Navigation Page to a Silverlight Business Application Template</a></td>
<td style="width: 100px" width="150">11 Minutes</td>
</tr>
<tr>
<td width="70">Part 5</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-speakers-page-template-with-converters-in-visual-studio-2010-beta2-article-5-of-7/">Adding Speakers Page Template With Converters In Visual Studio 2010 Beta2</a></td>
<td style="width: 100px" width="150">11 Minutes</td>
</tr>
<tr>
<td width="70">Part 6</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-a-sessions-page-that-includes-a-query-parameter-in-silverlight-vs2010-article-6-of-7/">Adding A Sessions Page That Includes a Query Parameter In Silverlight VS2010 Beta2</a></td>
<td style="width: 100px" width="150">10 Minutes</td>
</tr>
<tr>
<td width="70">Part 7</td>
<td><a href="http://peterkellner.net/2010/01/25/authentication-and-authorization-using-ria-services-article-7-of-7/">Basic Authentication and Authorization In RIA Services</a></td>
<td style="width: 100px" width="150">5 Minutes</td>
</tr>
</tbody>
</table>
<p> 
<br /><img src="http://video.peterkellner.net/video/RIAServicesBayNet20090120/P1_Intro_Thumb.jpg" alt="media" /><br />

<p>I’ve heavily borrowed from Brad Abrams <a href="http://blogs.msdn.com/brada/archive/2009/11/19/pdc09-talk-building-amazing-business-applications-with-silverlight-4-ria-services-and-visual-studio-2010.aspx">PDC09 presentation</a> here and am very thankful for the help.&#160; I’m personally very excited about the opportunities <a href="http://silverlight.net/getstarted/riaservices/">RIA Services</a> gives us as developers to efficiently build powerful multi tier applications without compromise.</p>
<p>I’d recommend going to Brad Abrams PDC09 presentation mentioned above to get a better understanding of what Microsoft was thinking and its plans for RIA Services. The way I see it is RIA Services is built on the WCF Stack.&#160; It basically is a technology that let’s the developer create both client and server code at the same time.&#160; It essentially removes the middle layer form a development perspective, but keeps it there in a very physical way using all the power of WCF.&#160; For example, you create you logic on the server side and that code automatically gets migrated to the client for simplicity of calling.</p>
<p>For those interested where the motivation came from to to this, it’s an interesting story.&#160; Last week, <a href="http://blog.brandewinder.com/">Mathias Brandewinder</a>, the organizer of our local Bay.Net San Francisco user group emailed and asked if I could fill in last minute for the upcoming (actually today’s) bay.net meeting and, could I talk about RIA Services.&#160; Well, 2 years or so ago, I did a quite extensive Silverlight 1.1 project for Leverage Software using the first beta of the .CLR release of Silverlight (C#).&#160; I have to say, it was an awful experience.&#160; So, now at <a href="http://www.silverlight.net/">Silverlight</a> 4.0, RIA Services, I’m back and very excited. </p>
<p>By way of people that have helped me in the last week to get this far, just to name a few:&#160; <a href="http://blogs.msdn.com/brunoterkaly/default.aspx">Bruno Terkaly</a>, offering to do whatever he could and giving me tech tips, <a href="http://blogs.msdn.com/synergist/">Michael Scherotter</a> in “going to town” as he says to make the Speaker’s page look really nice in a live meeting, <a href="http://victorgaudioso.wordpress.com/">Victor Gaudioso</a> in taking time on his busy weekend to call me&#160; and offer help, <a href="http://blogs.msdn.com/brada/archive/2010/01/17/great-ria-services-overview-in-dr-dobbs.aspx">Brad Abrams</a> putting up with my list of naive questions and patiently responding, a slew of <a href="http://aspinsiders.com/default.aspx">ASPInsiders</a> who pointed me at an excellent place to host the videos, and <a href="http://hackingsilverlight.blogspot.com/">David Kelly</a> for giving me a nicely styled Silverlight player to show the videos on this blog.</p>
<p>I’m sitting in the mall below the <a href="http://www.microsoft.com/about/companyinformation/usaoffices/northwest/sanfrancisco.mspx">Microsoft Office in San Francisco</a> where the presentation will be in about 2 hours.&#160; Hopefully, I’ll finish all seven articles and get them posted to the internet very soon.&#160; I did the videos as just practice for my presentation.&#160; They are not polished or edited.&#160; I’m taking the chance of posting them in the hopes that they help someone struggling with all the new features like I have been during the last week.</p>
<p>Finally, this demo is built on live <a href="http://www.siliconvalley-codecamp.com/">Silicon Valley Code Camp</a> Data that has been collected over the past 4 years.&#160; I can’t really publish that database along with the completed solution before I clean and randomize the attendee data.&#160; Meanwhile, I will post the project code but it will not work until I’ve had a chance to clean up the database.&#160; My thinking is that it’s all positive and better to release the code now rather than wait until I have the database cleaned up.</p>
<p>Below is what the end result of what we are building will look like (if you make it through all the articles and videos).</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/UsingRIAServicesWithVisualStudio2010Beta_94F1/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/UsingRIAServicesWithVisualStudio2010Beta_94F1/image_thumb.png" width="414" height="494" /></a></p>
<p>Attached here is source that you can build with Visual Studio 2010 Beta 2 and it will work with No Database.&#160; The Domain Class is heavily modified from what is presented, but it will allow you to actually run and play with real data. </p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:f125b32d-a630-4c3b-838b-1dc56760eeb7" class="wlWriterSmartContent">
<p><a href="http://peterkellner.net/FilesForWebDownload/UsingRIAServicesWithVisualStudio2010Beta_94F1/RIAService_BayNet_NoDatabase.zip" target="_blank">Solution Zip File</a></p>
</p></div>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:758c6f86-44c4-4139-b6fe-133a4e6f71b4" class="wlWriterSmartContent">
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:758c6f86-44c4-4139-b6fe-133a4e6f71b4" class="wlWriterSmartContent"></div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2010/01/20/riaservices-silverlight-4-tutorial-svcc-part1of7-introduction/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<enclosure url="http://video.peterkellner.net/video/RIAServicesBayNet20090120/P1_Intro.flv" length="1" type="video/x-flv"/>
	</item>
		<item>
		<title>Bravo for ORCSWeb! On so many fronts</title>
		<link>http://peterkellner.net/2009/07/27/orcsweb-hosting-company-awesome-review/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=orcsweb-hosting-company-awesome-review</link>
		<comments>http://peterkellner.net/2009/07/27/orcsweb-hosting-company-awesome-review/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 19:59:07 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>
		<category><![CDATA[ASP.NET 3.5]]></category>
		<category><![CDATA[Code Camp Web Site Series]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[Sql Server 2008]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/07/27/orcsweb-hosting-company-awesome-review/</guid>
		<description><![CDATA[Many of you know of ORCSWeb either by reputation, or by way of Scott Forsyth, one of my ASP.NET MVP brothers.&#160; In case you don’t, they are a managed hosting solutions company specializing in Microsoft technologies.&#160; I’ve used their basic services for quite a while and have always been very happy.&#160; It has always seemed [...]]]></description>
			<content:encoded><![CDATA[<p>Many of you know of <a href="http://www.orcsweb.com/">ORCSWeb</a> either by reputation, or by way of <a href="http://weblogs.asp.net/owscott/default.aspx">Scott Forsyth</a>, one of my ASP.NET MVP brothers.&#160; In case you don’t, they are a managed hosting solutions company specializing in Microsoft technologies.&#160; I’ve used their basic services for quite a while and have always been very happy.&#160; It has always seemed that anytime I’ve called them (and it always seems like the middle of the night) one of their tech support staff is always available to help me, and go the extra mile if necessary.</p>
<p>The company I’m now working at is small and we don’t have a lot of resources to maintain hardware and do operating system type support.&#160; We do have a high load requirement so we need a very robust supported solution.&#160; Before this, I’d always been in the under $50 per month type plan with ORCSWeb, but I decided I needed more servers and a higher level of support.&#160; I really did not know what level of support to expect when signing up for the managed servers but decided to go for it anyway.</p>
<p>All&#160; can say is <strong>WOW!!!</strong>&#160; I am over the top impressed. </p>
<p> <span id="more-337"></span>
<p>We currently have 3 virtual servers hosted at ORCSWeb.&#160; One, we use as a development server, and the other two are in a webfarm configuration.&#160; I’ve always believed that when you go into production with a web site it’s critical you start with 2 servers in a webfarm.&#160; it’s really easy to go from 2 to 10, but can be very painful to go from 1 to 2.&#160;&#160; That’s a topic for another post, but suffice it to say, 2 is the minimum.</p>
<p>So, why am I so impressed?&#160; First, the support team they assigned to me is totally awesome.&#160; They all are focussed and competent which is a total relief compared with most hosting companies I’ve dealt with.&#160; Other companies always have good people, but it seems to be the bad ones that really give me cause to remember.&#160; Second, because I paid extra for the full managed support options on our three servers, I’ve been able to ask the things like the following.&#160; Almost all of them I could do myself, but I’m swamped with my technology role in the new company and really appreciate being able to hand stuff like this off.</p>
<ul>
<li>I’ve pointed my MX record at my .149 server.&#160; Could you please set up email and create the following 7 accounts. </li>
<li>Please Setup a secure ftp server at the following address with the following username and password (and make sure the user is locked down to the root) </li>
<li>Setup DFS Replication between these two directories on .148 and .149 </li>
<li>Create a RoboCopy script that copies files from my dev server to the .149 mirrored directory </li>
<li>Please set up web statistics for me on <a href="http://www.siliconvalley-codecamp.com">http://www.siliconvalley-codecamp.com</a> </li>
<li>Please figure out why SqlServer 2008 is not letting me access catalog MyStuff1 from user 3p1 and fix </li>
<li>Please make a replicate of website MyWeb1.com including the sqlserver catalog’s and put it on MyWeb2.com on server .149 </li>
<li>Please replace the sqlserver catalog MyStuff3 on server .149 with the bak file I uploaded to my ftp server </li>
<li>I could go on and on, but I think you are getting the idea. </li>
<li>Always with a smile, 24&#215;7, what else can I say. </li>
</ul>
<p>By the way, if you want to see one of my sites hosted there, go to <a href="http://www.siliconvalley-codecamp.com">http://www.siliconvalley-codecamp.com</a></p>
<p>Thank you <a href="http://www.orcsweb.com/">ORCSWeb</a> for making things a lot easier for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/07/27/orcsweb-hosting-company-awesome-review/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Smallest xmlHttp I Could Do And Still Get It Wrong</title>
		<link>http://peterkellner.net/2008/09/29/xmlhttp-ajax-microsoft-pageload-virtualearth/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=xmlhttp-ajax-microsoft-pageload-virtualearth</link>
		<comments>http://peterkellner.net/2008/09/29/xmlhttp-ajax-microsoft-pageload-virtualearth/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 14:11:05 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[Atlas/AJAX]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2008/09/29/xmlhttp-ajax-microsoft-pageload-virtualearth/</guid>
		<description><![CDATA[I&#8217;ve just started my journey into the land of JavaScript for real and am learning things most of you already know.&#160; For example, as the Silicon Valley Code Camp coordinator and web site author, I just recently decided to add a Virtual Earth Map showing attendees and speakers (see the home page).&#160; I wrote a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just started my journey into the land of JavaScript for real and am learning things most of you already know.&#160; For example, as the <a href="http://www.siliconvalley-codecamp.com/">Silicon Valley Code Camp</a> coordinator and web site author, I just recently decided to add a <a href="http://dev.live.com/virtualearth/">Virtual Earth</a> Map showing attendees and speakers (see the home page).&#160; I wrote a simple web response handler that returns all the data in <a href="http://www.json.org/">JSON</a> so I could plot the data.&#160; Then, after a couple searches on the web, I found a way to send a request to the service asynchronously and get the result. The code looks something like this:</p>
<p> <span id="more-172"></span>
<p>&#160;</p>
<div class="csharpcode">
<pre class="alt"> <span class="kwrd">function</span> pageLoad() {</pre>
<pre>        req = <span class="kwrd">new</span> ActiveXObject(<span class="str">&quot;Msxml2.XMLHTTP&quot;</span>);</pre>
<pre class="alt">        <span class="kwrd">if</span> (req) {</pre>
<pre>            req.onreadystatechange = processStateChange;</pre>
<pre class="alt">            req.open(<span class="str">&quot;GET&quot;</span>, <span class="str">&quot;AttendeeZipCode.ashx&quot;</span>, <span class="kwrd">true</span>);</pre>
<pre>            req.send();</pre>
<pre class="alt">        }</pre>
<pre>    }</pre>
<pre class="alt">&#160;</pre>
<pre>    <span class="kwrd">function</span> processStateChange() {</pre>
<pre class="alt">        statusDiv = document.getElementById(<span class="str">&quot;stats&quot;</span>);</pre>
<pre>        <span class="kwrd">if</span> (req.readyState == 0) { statusDiv.innerHTML = <span class="str">&quot;UNINITIALIZED&quot;</span>; }</pre>
<pre class="alt">        <span class="kwrd">if</span> (req.readyState == 1) { statusDiv.innerHTML = <span class="str">&quot;LOADING&quot;</span>; }</pre>
<pre>        <span class="kwrd">if</span> (req.readyState == 2) { statusDiv.innerHTML = <span class="str">&quot;LOADED&quot;</span>; }</pre>
<pre class="alt">        <span class="kwrd">if</span> (req.readyState == 3) { statusDiv.innerHTML = <span class="str">&quot;INTERACTIVE&quot;</span>; }</pre>
<pre>        <span class="kwrd">if</span> (req.readyState == 4) {</pre>
<pre class="alt">            <span class="rem">//statusDiv.innerHTML = &quot;COMPLETE&quot;;</span></pre>
<pre>            GetMap();</pre>
<pre class="alt">            <span class="rem">//statusDiv.innerHTML = req.responseText;</span></pre>
<pre>            <span class="kwrd">var</span> dataObject = json_parse(req.responseText);</pre>
<pre class="alt">&#160;</pre>
<pre>            CreateLayerAttendees();</pre>
<pre class="alt">            CreateLayerSpeakers();</pre>
<pre>            <span class="kwrd">var</span> points = <span class="kwrd">new</span> Array();</pre>
<pre class="alt">            <span class="kwrd">for</span> (<span class="kwrd">var</span> i = 0; i &lt; dataObject.length; i++) {</pre>
<pre>                <span class="kwrd">var</span> lattitude = dataObject[i].lattitude;</pre>
<pre class="alt">                <span class="kwrd">var</span> longitude = dataObject[i].longitude;</pre>
<pre>                points[i] = <span class="kwrd">new</span> VELatLong(lattitude, longitude);</pre>
<pre class="alt">                <span class="kwrd">if</span> (dataObject[i].isSpeaker) {</pre>
<pre>                    AddOnePin(layerSpeaker, lattitude, longitude, <span class="str">&quot;x&quot;</span>, <span class="str">&quot;x&quot;</span>, <span class="kwrd">true</span>);</pre>
<pre class="alt">                }</pre>
<pre>                <span class="kwrd">else</span> {</pre>
<pre class="alt">                    AddOnePin(layerAttendee, lattitude, longitude, <span class="str">&quot;x&quot;</span>, <span class="str">&quot;x&quot;</span>, <span class="kwrd">false</span>);</pre>
<pre>                }</pre>
<pre class="alt">                AddOnePin(layerAttendee, lattitude, longitude, <span class="str">&quot;x&quot;</span>, <span class="str">&quot;x&quot;</span>,dataObject[i].isSpeaker);</pre>
<pre>            }</pre>
<pre class="alt">            map.SetMapView(points);</pre>
<pre>        }</pre>
<pre class="alt">    }</pre>
</div>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Well, that worked great until I ran it on Firefox and Chrome.&#160; Basically, nothing happened.&#160; So, off to my smart friends at the local <a href="https://sv-web-jug.dev.java.net/">Java Users Group</a> and they suggested I should use a JavaScript library because my solution only works for IE.&#160; With that hint, I grabbed my favorite AJAX book by <a href="http://peterkellner.net/2007/11/26/ajaxinactionbookreview/">Alessandro Gallo, Ajax in Action</a> and started reading.&#160; Turns out, there is indeed a Microsoft Ajax Library solution to this and here it is.</p>
<div class="csharpcode">
<pre class="alt"> <span class="kwrd">function</span> pageLoad() {</pre>
<pre>            <span class="kwrd">var</span> request = <span class="kwrd">new</span> Sys.Net.WebRequest();</pre>
<pre class="alt">            request.set_url(<span class="str">&quot;AttendeeZipCode.ashx&quot;</span>);</pre>
<pre>            request.add_completed(onRequestCompleted);</pre>
<pre class="alt">            request.invoke();</pre>
<pre>        }</pre>
<pre class="alt">&#160;</pre>
<pre>        <span class="kwrd">function</span> onRequestCompleted(executor, args) {</pre>
<pre class="alt">            processResults(executor.get_responseData());</pre>
<pre>        }</pre>
</div>
<p>Now, Firefox, Chrome, and IE all work!&#160; and, look what a nice result we get.</p>
<p><a href="http://www.siliconvalley-codecamp.com/Default.aspx"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://www.peterkellner.net/FilesForWebDownload/TheSmallestxmlHttpICouldDoAndStillGetItW_64F0/image_thumb.png" width="232" height="244" /></a></p>
<p>Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2008/09/29/xmlhttp-ajax-microsoft-pageload-virtualearth/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>View a Generic List with ASP.NET MVC. Step by Step With Preview 5</title>
		<link>http://peterkellner.net/2008/09/09/mvc-tutorial-simple-generic-list-preview5/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mvc-tutorial-simple-generic-list-preview5</link>
		<comments>http://peterkellner.net/2008/09/09/mvc-tutorial-simple-generic-list-preview5/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 18:35:28 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 3.5]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2008/09/09/mvc-tutorial-simple-generic-list-preview5/</guid>
		<description><![CDATA[I&#8217;ve just started (within the past 2 days) learning and building a prototype with Microsoft&#8217;s new MVC platform.&#160; It&#8217;s really just another project type in Visual Studio 2008, but it changes the way you write asp.net applications.&#160; So far I like it, but I&#8217;m still on the honeymoon.&#160; I have not really tried to do [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just started (within the past 2 days) learning and building a prototype with <a href="http://forums.asp.net/">Microsoft&#8217;s new MVC platform</a>.&#160; It&#8217;s really just another project type in <a href="http://msdn.microsoft.com/en-us/vstudio/default.aspx">Visual Studio 2008</a>, but it changes the way you write asp.net applications.&#160; So far I like it, but I&#8217;m still on the honeymoon.&#160; I have not really tried to do anything complex yet, and because it&#8217;s new to me, the simple things are still hard.&#160; <a href="http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx">Scott Guthrie&#8217;s</a> posts posts have been helpful, as well as reading a pre-release of Manning&#8217;s upcoming book <a href="http://manning.com/palermo/">ASP.NET MVC In Action</a> by <a href="http://jeffreypalermo.com/">Jeffrey Palermo</a>, <a href="http://www.flux88.com/">Ben Scheirman</a> and <a href="http://grabbagoft.blogspot.com/">Jimmy Bogard</a>.</p>
<p> <span id="more-158"></span>
<p>So, as is normal, when I learn something new, the most obvious things just don&#8217;t seem to work.&#160; In this case, I&#8217;m just trying to make a web page that shows a list of data on a page.&#160; I&#8217;m not going to try and teach MVC here, but if you are like me and struggled with this, this should help you get through some of the tough spots. My plan is to start a new MVC project with Visual Studio and show you what is necessary to generate the list.&#160; Instead of going after a database, I&#8217;m going to use an simple business object class so you can run this without connecting to a database.&#160; Not sure about you, but I never seem to be able to get the databases from example code working.&#160; Scott Guthrie uses the Northwind databases Product table, and after spending about 15 minutes searching, all I could find was a <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&amp;displaylang=en">Northwind database from sqlserver 2000</a> that does not have a Product table.&#160; With my demo, you won&#8217;t have to worry about that.&#160; By the way, here is the project if you want to download it in action.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:18d43e01-4549-4fde-8ca6-c7b4b7385fac:176475a3-eab9-41db-8107-c37ea0c2a70b" class="wlWriterSmartContent">
<p>Download Solution &#8211; <a href="http://peterkellner.net/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/Solution.zip">Solution.zip</a></p>
</p></div>
<p>So, Here we go.&#160; First thing, Open Visual Studio 2008 and create a new MVC Project (not a web site, this will give you a csproj type file)</p>
<p>&#160;<a href="http://peterkellner.net/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_thumb.png" width="535" height="424" /></a></p>
<p>Answer the next question YES because of course you want a Test Project.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_3.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_thumb_3.png" width="424" height="284" /></a></p>
<p>You should get a Solution that looks like this:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_4.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_thumb_4.png" width="197" height="330" /></a></p>
<p>Now, Add the business object that I will be using for this rest of this demonstration.&#160; It&#8217;s in the project file, our you just download it here (put this in your Models Directory).</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:73729366-c7a7-43f3-a538-5ec829978430" class="wlWriterSmartContent">
<p>BusinessObjectClass.cs <a href="http://peterkellner.net/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/BusinessObjectClass.cs" target="_blank">BusinessObjectClass.cs</a></p>
</p></div>
<p>Now, let&#8217;s create the MVC Controller.&#160; Highlight the Controller&#8217;s Folder and say Add Item (TMI if I show you that).&#160; Here is the dialog.&#160; Create the name of your controller with the syntax {Name}Controller.&#160; In my case, the name is EmailListControler.cs.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_5.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_thumb_5.png" width="424" height="293" /></a></p>
<p>Add the following code to your EmailListController.cs file to retrieve some data and return it as a View (which will be processed by the View Page coming up).</p>
<div class="csharpcode">
<pre class="alt"><span class="kwrd">using</span> System.Collections.Generic;</pre>
<pre><span class="kwrd">using</span> System.Linq;</pre>
<pre class="alt"><span class="kwrd">using</span> System.Web.Mvc;</pre>
<pre>&#160;</pre>
<pre class="alt"><span class="kwrd">namespace</span> Solution.Controllers</pre>
<pre>{</pre>
<pre class="alt">    <span class="kwrd">public</span> <span class="kwrd">class</span> EmailListController : Controller</pre>
<pre>    {</pre>
<pre class="alt">        <span class="kwrd">public</span> ActionResult Index()</pre>
<pre>        {</pre>
<pre class="alt">            var businessObject = <span class="kwrd">new</span> BusinessObject();</pre>
<pre>            List&lt;BusinessObjectItem&gt; members = </pre>
<pre class="alt">                businessObject.GetMembers();</pre>
<pre>            <span class="kwrd">return</span> View(<span class="str">&quot;Index&quot;</span>, members);</pre>
<pre class="alt">        }</pre>
<pre>    }</pre>
<pre class="alt">}<span class="kwrd">using</span> System.Collections.Generic;</pre>
<pre><span class="kwrd">using</span> System.Linq;</pre>
<pre class="alt"><span class="kwrd">using</span> System.Web.Mvc;</pre>
<pre>&#160;</pre>
<pre class="alt"><span class="kwrd">namespace</span> Solution.Controllers</pre>
<pre>{</pre>
<pre class="alt">    <span class="kwrd">public</span> <span class="kwrd">class</span> EmailListController : Controller</pre>
<pre>    {</pre>
<pre class="alt">        <span class="kwrd">public</span> ActionResult Index()</pre>
<pre>        {</pre>
<pre class="alt">            var businessObject = <span class="kwrd">new</span> BusinessObject();</pre>
<pre>            List&lt;BusinessObjectItem&gt; members = </pre>
<pre class="alt">                businessObject.GetMembers();</pre>
<pre>            <span class="kwrd">return</span> View(<span class="str">&quot;Index&quot;</span>, members);</pre>
<pre class="alt">        }</pre>
<pre>    }</pre>
<pre class="alt">}</pre>
</div>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Then, create a new folder called EmailList under the Views folder.</p>
<p>&#160;<a href="http://peterkellner.net/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_6.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_thumb_6.png" width="244" height="142" /></a></p>
<p>Then, create a MVCViewPage in the EmailList folder called Index.aspx.</p>
<p>&#160;<a href="http://peterkellner.net/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_7.png"><img alt="image" src="/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_thumb_7.png" width="612" height="360" /></a></p>
<p>(Actually, choose MVC View Content Page, not MVC View Page)</p>
<p>Then, chose the Master Page to use as follows (there is only one):</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_8.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_thumb_8.png" width="579" height="354" /></a></p>
<p>The View will be referring to the ViewData.Model which somehow is associated with how the code behind is implemented. Make sure you have the ViewPage look like the following and the data type specified as below.&#160; This is the file Index.aspx.cs which is in your email directory.</p>
<div class="csharpcode">
<pre class="alt"><span class="kwrd">using</span> System.Collections.Generic;</pre>
<pre><span class="kwrd">using</span> System.Web.Mvc;</pre>
<pre class="alt">&#160;</pre>
<pre><span class="kwrd">namespace</span> Solution.Views.EmailList</pre>
<pre class="alt">{</pre>
<pre>    <span class="kwrd">public</span> <span class="kwrd">partial</span> <span class="kwrd">class</span> Index :</pre>
<pre class="alt">        ViewPage&lt;IEnumerable&lt;BusinessObjectItem&gt;&gt;</pre>
<pre>    {</pre>
<pre class="alt">    }</pre>
<pre>}</pre>
</div>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Now, for the Index.aspx file which is also in your Views/EmailList directory, enter the following between the content tags.</p>
<p>&#160;</p>
<div class="csharpcode">
<pre class="alt">&lt;table border=<span class="str">&quot;1&quot;</span>&gt;</pre>
<pre>    &lt;tr&gt;</pre>
<pre class="alt">        &lt;td&gt;</pre>
<pre>            &lt;strong&gt;Name&lt;/strong&gt;</pre>
<pre class="alt">        &lt;/td&gt;</pre>
<pre>        &lt;td&gt;</pre>
<pre class="alt">            &lt;strong&gt;&lt;strong&gt;Email Address&lt;/strong&gt;</pre>
<pre>        &lt;/td&gt;</pre>
<pre class="alt">    &lt;/tr&gt;</pre>
<pre>    &lt;% <span class="kwrd">foreach</span> (var emailItem <span class="kwrd">in</span> ViewData.Model)</pre>
<pre class="alt">       { %&gt;</pre>
<pre>    &lt;tr&gt;</pre>
<pre class="alt">        &lt;td&gt;</pre>
<pre>            &lt;%= emailItem.Name %&gt;</pre>
<pre class="alt">        &lt;/td&gt;</pre>
<pre>        &lt;td&gt;</pre>
<pre class="alt">            &lt;%=emailItem.Email %&gt;</pre>
<pre>        &lt;/td&gt;</pre>
<pre class="alt">    &lt;/tr&gt;</pre>
<pre>    &lt;% } %&gt;</pre>
<pre class="alt">&lt;/table&gt;</pre>
</div>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Notice that you have intellisense working on your foreach items.</p>
<p>&#160;<a href="http://peterkellner.net/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_9.png"><img alt="image" src="/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_thumb_9.png" width="554" height="141" /></a></p>
<p>Finally, go to your Master Page and add a link for this new EmailList as follows.&#160; That is, change the file /Views/Shared/Site.Master</p>
<div class="csharpcode">
<pre class="alt">&lt;ul id=<span class="str">&quot;menu&quot;</span>&gt;              </pre>
<pre>    &lt;li&gt;&lt;%= Html.ActionLink(<span class="str">&quot;Home&quot;</span>, <span class="str">&quot;Index&quot;</span>, <span class="str">&quot;Home&quot;</span>)%&gt;&lt;/li&gt;</pre>
<pre class="alt">    &lt;li&gt;&lt;%= Html.ActionLink(<span class="str">&quot;About Us&quot;</span>, <span class="str">&quot;About&quot;</span>, <span class="str">&quot;Home&quot;</span>)%&gt;&lt;/li&gt;</pre>
<pre>    &lt;li&gt;&lt;a href=<span class="str">&quot;/EmailList&quot;</span>&gt;Email List&lt;/a&gt;&lt;/li&gt;</pre>
<pre class="alt">&lt;/ul&gt;</pre>
</div>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>As you can see, I don&#8217;t quite grock the ActionLinke parameters so I just put in a standard anchor tag.&#160; Please comment below on what it should be to be able to reference /EmailList and I will update the article.&#160; For now, lunch is coming and I need to run.</p>
<p>When you finally run that app, you get this for your new output.&#160; Notice the New Email List Tab.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_10.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="/FilesForWebDownload/ViewaLINQListwith.StepbyStepWithPreview5_7BE7/image_thumb_10.png" width="625" height="382" /></a></p>
<p>That&#8217;s it for now.&#160; Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2008/09/09/mvc-tutorial-simple-generic-list-preview5/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Assigning a DropDownList Value in a ASP.NET GridView Using ObjectDataSource</title>
		<link>http://peterkellner.net/2008/08/05/assign-dropdownlist-in-aspdotnet-to-gridview-in-objectdatasource/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=assign-dropdownlist-in-aspdotnet-to-gridview-in-objectdatasource</link>
		<comments>http://peterkellner.net/2008/08/05/assign-dropdownlist-in-aspdotnet-to-gridview-in-objectdatasource/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 23:57:14 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 3.5]]></category>
		<category><![CDATA[GridView]]></category>
		<category><![CDATA[ObjectDataSource]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2008/08/05/assign-dropdownlist-in-aspdotnet-to-gridview-in-objectdatasource/</guid>
		<description><![CDATA[As a moderator in the asp.net forums, I often see the same or similar questions.&#160; The answer to this question is pretty straight forward but not 100% obvious so I thought I&#8217;d do a post about in the hopes that with a couple key words, people will find the answer.&#160; The title basically says it [...]]]></description>
			<content:encoded><![CDATA[<p>As a moderator in the <a href="http://forums.asp.net/">asp.net forums</a>, I often see the same or similar questions.&nbsp; The answer to this question is pretty straight forward but not 100% obvious so I thought I&#8217;d do a post about in the hopes that with a couple key words, people will find the answer.&nbsp; The title basically says it all.&nbsp; We have a GridView that has a data column of type bool.&nbsp; We want to display in the GridView Yes or No depending on whether the data value is true or false.&nbsp; The example I&#8217;m showing does not help with making this an editable field (maybe a theme for another post if this one is popular) but simply shows yes or no.</p>
<p>The solution involves first dropping a <a href="http://msdn.microsoft.com/en-us/library/aa479339.aspx">GridView</a> and ObjectDataSource onto your design surface in Visual Studio.&nbsp; Then, using the little chevron on the GridView, choose edit columns and convert the column you are interested in making a <a href="http://www.w3schools.com/aspnet/control_dropdownlist.asp">DropDownList</a> into a template.&nbsp; From there replace the <a href="http://msdn.microsoft.com/en-us/library/aa479353.aspx">ItemTemplate</a> with the DropDownList code below.&nbsp; You get the code below.</p>
<p>&nbsp;</p>
<div class="csharpcode">
<pre class="alt"><span class="asp">&lt;%@ Page Language="C#" %&gt;</span></pre>
<pre>&nbsp;</pre>
<pre class="alt"><span class="kwrd">&lt;!</span><span class="html">DOCTYPE</span> <span class="attr">html</span> <span class="attr">PUBLIC</span> <span class="kwrd">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> </pre>
<pre><span class="kwrd">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">&nbsp;</pre>
<pre><span class="kwrd">&lt;</span><span class="html">script</span> <span class="attr">runat</span><span class="kwrd">="server"</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">&nbsp;</pre>
<pre><span class="kwrd">&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">&nbsp;</pre>
<pre><span class="kwrd">&lt;</span><span class="html">html</span> <span class="attr">xmlns</span><span class="kwrd">="http://www.w3.org/1999/xhtml"</span><span class="kwrd">&gt;</span></pre>
<pre class="alt"><span class="kwrd">&lt;</span><span class="html">head</span> <span class="attr">runat</span><span class="kwrd">="server"</span><span class="kwrd">&gt;</span></pre>
<pre>    <span class="kwrd">&lt;</span><span class="html">title</span><span class="kwrd">&gt;</span>ODS DDL Example<span class="kwrd">&lt;/</span><span class="html">title</span><span class="kwrd">&gt;</span></pre>
<pre class="alt"><span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span></pre>
<pre><span class="kwrd">&lt;</span><span class="html">body</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">    <span class="kwrd">&lt;</span><span class="html">form</span> <span class="attr">id</span><span class="kwrd">="form1"</span> <span class="attr">runat</span><span class="kwrd">="server"</span><span class="kwrd">&gt;</span></pre>
<pre>    <span class="kwrd">&lt;</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">        <span class="kwrd">&lt;</span><span class="html">asp:ObjectDataSource</span> <span class="attr">ID</span><span class="kwrd">="ObjectDataSource1"</span> <span class="attr">runat</span><span class="kwrd">="server"</span> <span class="attr">SelectMethod</span><span class="kwrd">="GetMembers"</span></pre>
<pre>            <span class="attr">TypeName</span><span class="kwrd">="BusinessObject"</span><span class="kwrd">&gt;&lt;/</span><span class="html">asp:ObjectDataSource</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">        <span class="kwrd">&lt;</span><span class="html">asp:GridView</span> <span class="attr">ID</span><span class="kwrd">="GridView1"</span> <span class="attr">runat</span><span class="kwrd">="server"</span> <span class="attr">AutoGenerateColumns</span><span class="kwrd">="False"</span> <span class="attr">DataKeyNames</span><span class="kwrd">="Id"</span></pre>
<pre>            <span class="attr">DataSourceID</span><span class="kwrd">="ObjectDataSource1"</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">            <span class="kwrd">&lt;</span><span class="html">Columns</span><span class="kwrd">&gt;</span></pre>
<pre>                <span class="kwrd">&lt;</span><span class="html">asp:BoundField</span> <span class="attr">DataField</span><span class="kwrd">="Id"</span> <span class="attr">HeaderText</span><span class="kwrd">="Id"</span> <span class="attr">ReadOnly</span><span class="kwrd">="True"</span> <span class="attr">SortExpression</span><span class="kwrd">="Id"</span> <span class="kwrd">/&gt;</span></pre>
<pre class="alt">                <span class="kwrd">&lt;</span><span class="html">asp:BoundField</span> <span class="attr">DataField</span><span class="kwrd">="Name"</span> <span class="attr">HeaderText</span><span class="kwrd">="Name"</span> <span class="attr">SortExpression</span><span class="kwrd">="Name"</span> <span class="kwrd">/&gt;</span></pre>
<pre>                <span class="kwrd">&lt;</span><span class="html">asp:BoundField</span> <span class="attr">DataField</span><span class="kwrd">="Email"</span> <span class="attr">HeaderText</span><span class="kwrd">="Email"</span> <span class="attr">SortExpression</span><span class="kwrd">="Email"</span> <span class="kwrd">/&gt;</span></pre>
<pre class="alt">                <span class="kwrd">&lt;</span><span class="html">asp:TemplateField</span> <span class="attr">HeaderText</span><span class="kwrd">="Approved"</span> <span class="attr">SortExpression</span><span class="kwrd">="Approved"</span><span class="kwrd">&gt;</span></pre>
<pre>                    <span class="kwrd">&lt;</span><span class="html">ItemTemplate</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">                        <span class="kwrd">&lt;</span><span class="html">asp:DropDownList</span> <span class="attr">ID</span><span class="kwrd">="DropDownListUser"</span> <span class="attr">runat</span><span class="kwrd">="server"</span> <span class="attr">AutoPostBack</span><span class="kwrd">="False"</span> </pre>
<pre>                            <span class="attr">SelectedValue</span><span class="kwrd">='&lt;%# Bind("Approved") %&gt;'</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">                            <span class="kwrd">&lt;</span><span class="html">asp:ListItem</span> <span class="attr">Text</span><span class="kwrd">="Yes"</span> <span class="attr">Value</span><span class="kwrd">="True"</span><span class="kwrd">&gt;&lt;/</span><span class="html">asp:ListItem</span><span class="kwrd">&gt;</span></pre>
<pre>                            <span class="kwrd">&lt;</span><span class="html">asp:ListItem</span> <span class="attr">Text</span><span class="kwrd">="No"</span> <span class="attr">Value</span><span class="kwrd">="False"</span><span class="kwrd">&gt;&lt;/</span><span class="html">asp:ListItem</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">                        <span class="kwrd">&lt;/</span><span class="html">asp:DropDownList</span><span class="kwrd">&gt;</span></pre>
<pre>                    <span class="kwrd">&lt;/</span><span class="html">ItemTemplate</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">                <span class="kwrd">&lt;/</span><span class="html">asp:TemplateField</span><span class="kwrd">&gt;</span></pre>
<pre>            <span class="kwrd">&lt;/</span><span class="html">Columns</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">        <span class="kwrd">&lt;/</span><span class="html">asp:GridView</span><span class="kwrd">&gt;</span></pre>
<pre>    <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
<pre class="alt">    <span class="kwrd">&lt;/</span><span class="html">form</span><span class="kwrd">&gt;</span></pre>
<pre><span class="kwrd">&lt;/</span><span class="html">body</span><span class="kwrd">&gt;</span></pre>
<pre class="
alt"><span class="kwrd">&lt;/</span><span class="html">html</span><span class="kwrd">&gt;</span></pre>
</div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>&nbsp;</p>
<p>And, when you run this code (assuming you have a simple business object that returns some data), you get this:</p>
<p>&nbsp;</p>
<p><a href="http://peterkellner.net/wp/wp-content/uploads/2008/08/x1.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="92" alt="x" src="http://peterkellner.net/wp/wp-content/uploads/2008/08/x-thumb1.png" width="314" border="0"/></a> </p>
<p>Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2008/08/05/assign-dropdownlist-in-aspdotnet-to-gridview-in-objectdatasource/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Building High Performance ASP.NET Web Applications Downloads</title>
		<link>http://peterkellner.net/2008/06/29/build-high-performance_web-applications-downloads/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=build-high-performance_web-applications-downloads</link>
		<comments>http://peterkellner.net/2008/06/29/build-high-performance_web-applications-downloads/#comments</comments>
		<pubDate>Sun, 29 Jun 2008 20:44:21 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2008/06/29/build-high-performance_web-applications-downloads/</guid>
		<description><![CDATA[<br /><p>Downloads for my presentation to BAADD titled "Building High Performance ASP.NET Web Applications".</p><br />]]></description>
			<content:encoded><![CDATA[<p>This past Wednesday, June 25th 2008, I did a presentation titled &#8220;<a href="http://peterkellner.net/2008/06/17/speaking-microsoft-office-june-25-2008-high-perf-aspnet/">Building High Performance ASP.NET Web Applications</a>&#8221; to the <a href="http://www.baadd.org/NET/tabid/56/Default.aspx">Bay Area Association of Database Developers (BAADD)</a>.&nbsp; Through out the presentation, I showed an application in <a href="http://msdn.microsoft.com/en-us/vstudio/products/aa700831.aspx">Visual Studio 2008</a>.&nbsp; I&#8217;m including that project file here as well as the power point slides used in the demonstration.</p>
<p>
<div class="wlWriterSmartContent" id="scid:18d43e01-4549-4fde-8ca6-c7b4b7385fac:9de1aefe-7d0d-40e3-b35c-603413b65c45" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">
<p>Download Solution &#8211; <a href="http://peterkellner.net/wp/wp-content/uploads/2008/06/heuristiccache2.zip">HeuristicCache.zip</a></p>
</div>
<p>And the Power Point Presentation:</p>
<p>
<div class="wlWriterSmartContent" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:dfb47607-6296-4d5c-8edf-cd4e933fca8f" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">
<p> <a href="http://peterkellner.net/wp/wp-content/uploads/2008/06/ppwebhigh2.pdf" target="_blank">Power Point Presentation</a></p>
</div>
<p>Any Questions, feel free to contact me at <a title="http://peterkellner.net/contact/" href="http://peterkellner.net/contact/">http://peterkellner.net/contact/</a></p>
<p><u><font color="#669966"></font></u></p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2008/06/29/build-high-performance_web-applications-downloads/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 32/40 queries in 0.015 seconds using disk: basic
Content Delivery Network via Amazon Web Services: S3: PetersBlogCDN.s3.amazonaws.com

Served from: peterkellner.net @ 2012-05-23 00:54:08 -->
