<?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; ASP.NET 2.0</title>
	<atom:link href="http://peterkellner.net/category/aspnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://peterkellner.net</link>
	<description>Microsoft Focussed, JavaScript (ExtJS, SenchaTouch &#38; Windows 8 Metro)</description>
	<lastBuildDate>Tue, 07 Feb 2012 21:14:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MACBook PRO running VMWARE Fusion with Visual Studio</title>
		<link>http://peterkellner.net/2012/02/07/macbook-pro-running-vmware-fusion-with-visual-studio/</link>
		<comments>http://peterkellner.net/2012/02/07/macbook-pro-running-vmware-fusion-with-visual-studio/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 20:59:28 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2012/02/07/macbook-pro-running-vmware-fusion-with-visual-studio/</guid>
		<description><![CDATA[I’ve been a macbook user for about 2 weeks now.&#160; As a Microsoft guy, it’s really important to me that the Macbook run Windows 7 really well.&#160; So far, I’m not impressed (hopefully this will change once you all give me some good advice).&#160; I’ve set up bootcamp on half my SSD drive and OSX [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been a macbook user for about 2 weeks now.&#160; As a Microsoft guy, it’s really important to me that the Macbook run Windows 7 really well.&#160; So far, I’m not impressed (hopefully this will change once you all give me some good advice).&#160; I’ve set up bootcamp on half my SSD drive and OSX Lion on the other half.&#160; VMWare seems to run reasonably well, but when I try and run Visual Studio I get lots of hanging and very very slow performance.&#160; I’ve got 16Gig of RAM and the latest macbook with a core i7.&#160; I’ve tried giving VMWARE 4 or 8 GB’s of ram, but have the same issues.</p>  <p>I’ve also run bootcamp native and had some hanging also, but not as bad as Fusion.</p>  <p>Anyone else have similar experiences?&#160; Any suggestions?&#160; I’ve heard that macbook’s are awesome at running windows 7.&#160; So far, I have not experience that.&#160; </p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2012/02/07/macbook-pro-running-vmware-fusion-with-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Take Defaults! (not customizations) When Installing Software</title>
		<link>http://peterkellner.net/2012/01/31/take-defaults-not-customizations-when-installing-software/</link>
		<comments>http://peterkellner.net/2012/01/31/take-defaults-not-customizations-when-installing-software/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 05:55:11 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2012/01/31/take-defaults-not-customizations-when-installing-software/</guid>
		<description><![CDATA[&#160;  Some Background  Years ago, my friend Bill Venners of Artima told me a life long lesson that I always seem to forget.&#160; He said that when people design installation programs, they always thoroughly test the “default” installation but not all the corner cases around custom options.  Today, while configuring my new [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>  <h2>Some Background</h2>  <p>Years ago, my friend Bill Venners of <a href="http://www.artima.com/weblogs/index.jsp?blogger=bv">Artima</a> told me a life long lesson that I always seem to forget.&#160; He said that when people design <a href="http://www.apple.com/macosx/recovery/">installation</a> programs, they always thoroughly test the “default” installation but not all the corner cases around custom options.</p>  <p>Today, while configuring my new <a href="http://www.apple.com/mac/">MacBook</a> (Best <a href="http://windows.microsoft.com/en-us/windows7/products/home">Windows 7</a> Computer Laptop they say), I learned this lesson all over again.&#160; So, here is the story.</p>  <p>&#160;</p>  <h2>   <p>How To Split Your Hard MacBook Primary Drive 50/50, IOS Lion and Windows 7</p> </h2>  <p>My thinking is that I need to first allocate a NTFS partition on the MacBook that takes half my hard drive and let the OSX Lion install take over the rest.&#160; After about 10 iterations of IOS complaining that it did not have enough resources, I finally decided to take a step backwards and ask myself “how would my mom be able to do this?” and we all know that Mac’s are designed for my mom.&#160; So, with that thinking, I just let the IOS Lion install take over the entire disk.&#160; Then I ran the Boot Camp Assistant.&#160; It asked me how much of my hard drive I wanted for Windows, I said 50% and everything ran perfect.&#160; No partition magic, no special setup, just take the defaults with <a href="http://www.apple.com/support/bootcamp/">bootcamp</a>!</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2012/01/31/take-defaults-not-customizations-when-installing-software/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PC verses MAC (let the debate continue)</title>
		<link>http://peterkellner.net/2012/01/24/pc-verses-mac-let-the-debate-continue/</link>
		<comments>http://peterkellner.net/2012/01/24/pc-verses-mac-let-the-debate-continue/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 19:14:37 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2012/01/24/pc-verses-mac-let-the-debate-continue/</guid>
		<description><![CDATA[&#160;  So, I know it’s hard to believe, but I am actually considering getting a Macbook to use as my main development computer.&#160; The reason is I’m using some beta mobile development tools that only support the Mac.&#160; The problem is that if I don’t use these tools and incrementally build my app with [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>  <p>So, I know it’s hard to believe, but I am actually considering getting a Macbook to use as my main development computer.&#160; The reason is I’m using some beta mobile development tools that only support the Mac.&#160; The problem is that if I don’t use these tools and incrementally build my app with them, I will get my app far out of wac (wac being a technical term) that I will never be able to get it back in wac again.&#160; </p>  <p>So, I have a good friend who is a Mac wizard and I thought I’d ask him a question.&#160; Below is my question and his answer.&#160; Keep in mind, my friend is very technical in the Mac world.</p>  <p>Question from me (PC Guy):</p>  <blockquote>   <p>I’ve been trying to figure that out for myself which Mac model to get.&#160; If I get one, I want SandyBridge or later.&#160; I think that’s quad core, but hard to tell.&#160; Apple just seems to give dates on the refurbished site for their computers.&#160; It’s also good to know they work with 16gb ram.&#160; I need that because I run big fat windows VM’s.&#160; The other thing I can’t quite figure out is if the 15’s support 2 drives internally if you are willing to forego the optical drive.&#160; I like to run the boot drive as SSD (SATA3) and the secondary drive as just a normal SATA2 or SATA3.</p> </blockquote>  <p>My Friends answer (MAC Guy)</p>  <blockquote>   <p>You&#8217;re talking like a pc guy. Pick the prettiest one.</p></blockquote>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2012/01/24/pc-verses-mac-let-the-debate-continue/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Testing Help From the Twitter Sphere, Anyone have an IPad1 Handy?</title>
		<link>http://peterkellner.net/2011/12/22/testing-help-from-the-twitter-sphere-anyone-have-an-ipad1-handy/</link>
		<comments>http://peterkellner.net/2011/12/22/testing-help-from-the-twitter-sphere-anyone-have-an-ipad1-handy/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 01:13:09 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2011/12/22/testing-help-from-the-twitter-sphere-anyone-have-an-ipad1-handy/</guid>
		<description><![CDATA[I’ve been working on an HTML5/CSS3 SenchaTouch project for many months now and near the end we our finding that we have problems on an IPad1 only and all I have is an IPad2.  My 700+ twitter buddies to the rescue.  I tweet:&#160;     And, within about 5 minutes comes [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been working on an HTML5/CSS3 <a href="http://sencha.com">SenchaTouch</a> project for many months now and near the end we our finding that we have problems on an IPad1 only and all I have is an IPad2.</p>  <p>My 700+ <a href="http://twitter.com">twitter</a> buddies to the rescue.</p>  <p>I tweet:&#160; </p>  <p><a href="http://twitter.com/pkellner"><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/wp/wp/wp-content/uploads/2011/12/image7.png" width="364" height="134" /></a></p>  <p>And, within about 5 minutes comes back:</p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/12/image8.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/wp/wp/wp-content/uploads/2011/12/image_thumb7.png" width="368" height="369" /></a></p>  <p>&#160;</p>  <p>Not to mention from <a href="http://www.facebook.com/">Facebook</a>, another one because my tweets go to Facebook also.</p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/12/image9.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/wp/wp/wp-content/uploads/2011/12/image_thumb8.png" width="469" height="207" /></a></p>  <p>&#160;</p>  <p>At any rate, I had 3 different people testing my app on an Ipad1 within 15 minutes.</p>  <p>Totally awesome and thank you social buddies!</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2011/12/22/testing-help-from-the-twitter-sphere-anyone-have-an-ipad1-handy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Boost Your SEO And Promote Silicon Valley Code Camp At The Same Time!</title>
		<link>http://peterkellner.net/2011/09/21/boost-your-seo-and-promote-silicon-valley-code-camp-at-the-same-time/</link>
		<comments>http://peterkellner.net/2011/09/21/boost-your-seo-and-promote-silicon-valley-code-camp-at-the-same-time/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 02:24:29 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>

		<guid isPermaLink="false">http://peterkellner.net/?p=1589</guid>
		<description><![CDATA[Introduction
We have new page on the under the // ABOUT menu on the Silicon Valley Code Camp web site.  It’s called   “Live Referral Links” and essentially, it’s real time tracking of referral traffic into the code camp web site.  We normally get thousands of requests a day processed by our servers. [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
We have new page on the under the <strong><em>// ABOUT</em></strong> menu on the <a href="http://www.siliconvalley-codecamp.com/">Silicon Valley Code Camp</a> web site.  It’s called   “Live Referral Links” and essentially, it’s real time tracking of referral traffic into the code camp web site.  We normally get thousands of requests a day processed by our servers. Most of these requests come from search engines, peoples email links, stored favorites, or just typing in the url themselves.  However, if a person arrives by clicking on the Silicon Valley Code Camp link at the site <a href="http://www.json.org/">http://www.json.org/</a>, that is called a referring link and it is passed to us along with the first request to display our home page.  In the code camp program, we are now capturing those referral links, putting the in a database and storing them to be presented.

That’s really only half the story.  Now that we have them, we need the author of that link (like Douglas Crockford in the case of <a href="http://www.json.org">http://www.json.org</a>) to log into there code camp account, go to a special page called “My Referral Links”, find from a list of incoming url’s the ones that are his, then essentially take credit for them.  Once he has done that (as below), when any user goes to the  <strong><em>// ABOUT</em></strong> page, then selects <strong><span style="background-color: #ffffff;">Live Referral Links</span></strong> as is pointed to by the first red arrow, they will see all the referrals to code camp’s site along with how many referrals there were and the user taking credit for those links.

Because the Silicon Valley Code Camp web site is known by the search engines as a very reliable source of knowledge, those sites listed in the Live Referral Links page will get ranked higher and will more often be found.  Also, users may directly click on those links and return to the site.

This is good for everyone!  Win-Win.

For the Attendees who create links to our site, they get great SEO in return as described above, and for Code Camp, well, we get more traffic and attention which is what we want.  Read on for how to setup your own referral links.

<a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image4.png"><img title="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image_thumb3.png" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" border="0" alt="image" width="613" height="370" /></a>

<span id="more-1589"></span>
<h2>Getting Your Links To Show</h2>
<h3>Put a link on your Blog Post, Company Web Site, Facebook Page, etc.</h3>
The first thing you need to do (if you have not done so already) is to put a link to <a href="http://www.siliconvalley-codecamp.com/">http://www.siliconvalley-codecamp.com/</a> on one of your pages.  Lots of people have done that by simply making a blog post about the event and in the post make sure you include plenty of hyperlinks to the code camp site.  No matter where on the site your link goes, you’ll get credit when someone clicks it.  That is, if you put a link directly to your sessions or track such as:  <a title="http://www.siliconvalley-codecamp.com/Sessions.aspx?track=25" href="http://www.siliconvalley-codecamp.com/Sessions.aspx?track=25">http://www.siliconvalley-codecamp.com/Sessions.aspx?track=25</a>, the person will land on the mobile track at code camp, but as far as you are concerned, you will get a “Referral Count” accumulated on your link.  For example, if you look at <a href="http://www.json.org">http://www.json.org</a> (as pictured below), you can see a Silicon Valley Code Camp link right in the middle of the page.  I just started counting referrals this morning and since then, 70 people have clicked on the link.

<a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image5.png"><img title="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image_thumb4.png" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" border="0" alt="image" width="299" height="272" /></a>
<h3>Once People Click On Your Link, Now What</h3>
The Code Camp database is accumulating those links in the background waiting for someone to come and claim them.  The way to claim them is to first, make sure you are logged into your account, then go to the <strong><em>// ABOUT</em></strong> menu on the <a href="http://www.siliconvalley-codecamp.com/">Silicon Valley Code Camp</a> web site and choose the option next to <strong>Live Referral Links</strong> called <strong>My Referral Links.</strong> See the screen shot at the top of this post.  If you don’t have the My Referral links, it most likely means you are not a speaker and we will need to enable that feature on your account.  Email to <a href="mailto:service@siliconvalley-codecamp.com">service@siliconvalley-codecamp.com</a> and we will enable your account so you can chose this option (and promise us you will not be advertising your drug company online here <img src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/wlEmoticon-smile.png" style="border-style: none;" alt="Smile" class="wlEmoticon wlEmoticon-smile" />).

Now, you will be presented with a page that looks like this.  For the purpose of this demonstration, I’m going to log in as myself and “claim” some of the SEO I’ve been generating for code camp.  Here is the screen you should see.

<a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image6.png"><img title="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image_thumb5.png" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" border="0" alt="image" width="438" height="295" /></a>

Notice that there is dropdownlist that contains all the unspoken for incoming referral links.  We are all on the honor system here so please only look for ones that belong to you.  If you drop the list down (as shown below), you’ll see the full list.  Currently, we are only showing referrals that have generated more than 3 hits, however later, we will probably up this number so the list does not get too long.

<a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image7.png"><img title="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image_thumb6.png" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" border="0" alt="image" width="553" height="343" /></a>

You can see that I’ve selected my site and the count is 18.  that means, since this morning, 18 people have gone to <a href="http://peterkellner.net">http://peterkellner.net</a>, and on the right side of my blog, I have a link I generated from the Silicon Valley Code Camp “Spread The Word” page and lots of people (18) have clicked on it.  BTW, that’s a hint.  Go to that page and get a really cool chunk of HTML that you can paste into your post or page and you will have the same thing as me.  Several people actually put that right in there post about code camp.  It’s very convenient.  Just for reference, here is a picture of my <a href="http://peterkellner.net">http://peterkellner.net</a> site that includes the link to <a href="http://www.siliconvalley-codecamp.com">http://www.siliconvalley-codecamp.com</a>.

<a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image8.png"><img title="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image_thumb7.png" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" border="0" alt="image" width="333" height="219" /></a>

So, once I’ve selected that from the dropdown, I see a scrren that let’s me push a button saying “Claim the Item Selected in the Above Dropdown as Your Own”.  When I press that, I now have claimed it and I’m rewared with this screen below.

<a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image9.png"><img title="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image_thumb8.png" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" border="0" alt="image" width="435" height="250" /></a>

If this is all you do, you are in pretty good shape.  If you go back to the “Live Referral Links” page, you will immediately see that your link is now being tracked for the world to see.  Here is what it looks like now.

<a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image10.png"><img title="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image_thumb9.png" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" border="0" alt="image" width="489" height="344" /></a>

If you wanted, you could have pressed the &#8220;<span style="text-decoration: underline;">Edit</span>” button on the previous screen and put a more descriptive name for the URL to show as well as the name of the group you posted in. For example, say this was the home page of bay.net.  You could put Bay.Net as the name of the link rather than the ugly link created by the referral.  Your credit is still the same.  Also, the last column shown is from your registration page (web site).

That’s it for now.  Start Posting!!!]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2011/09/21/boost-your-seo-and-promote-silicon-valley-code-camp-at-the-same-time/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Silicon Valley Code Camp Login Failing with IE10 (Fixed Now)</title>
		<link>http://peterkellner.net/2011/09/20/silicon-valley-code-camp-login-failing-with-ie10-fixed-now/</link>
		<comments>http://peterkellner.net/2011/09/20/silicon-valley-code-camp-login-failing-with-ie10-fixed-now/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 17:10:29 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[.Net 2.0]]></category>
		<category><![CDATA[ASP.NET 2.0]]></category>
		<category><![CDATA[ASP.NET 4.0]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2011/09/20/silicon-valley-code-camp-login-failing-with-ie10-fixed-now/</guid>
		<description><![CDATA[&#160;  Scott Hanselman posted a while back about a browsers definition problem with some ASP.NET sites that causes problems.&#160; Microsoft has articles on this also.&#160; Having just received my BUILD tablet that includes IE10, I tested the Silicon Valley Code Camp web site and discovered that when you login, then switch to another page, [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>  <p><a href="http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx">Scott Hanselman posted</a> a while back about a browsers definition problem with some ASP.NET sites that causes problems.&#160; Microsoft has <a href="http://support.microsoft.com/kb/2600088">articles</a> on this also.&#160; Having just received my <a href="http://www.buildwindows.com/">BUILD</a> tablet that includes IE10, I tested the <a href="http://www.siliconvalley-codecamp.com/">Silicon Valley Code Camp web site</a> and discovered that when you login, then switch to another page, the login did not stick.&#160; After uploading the two files Scott mentions (<a href="http://msdn.microsoft.com/en-us/library/ms228122.aspx">firefox.browser and ie.browser</a>), the problem goes away.</p>  <p>Thanks Scott for the heads up.</p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/image3.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/wp/wp/wp-content/uploads/2011/09/image_thumb2.png" width="657" height="350" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2011/09/20/silicon-valley-code-camp-login-failing-with-ie10-fixed-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WinRT in Windows 8 CLR Confusion</title>
		<link>http://peterkellner.net/2011/09/15/winrt-in-windows-8-clr-confusion/</link>
		<comments>http://peterkellner.net/2011/09/15/winrt-in-windows-8-clr-confusion/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 17:01:39 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2011/09/15/winrt-in-windows-8-clr-confusion/</guid>
		<description><![CDATA[I’m here at the Microsoft BUILD conference in Anaheim and am very much enjoying all the announcements surrouding the next major release of Windows (at least a year or two out).&#160; One of the big speculations that has drawn a lot of confusion over the past few months is whether .Net is going to part [...]]]></description>
			<content:encoded><![CDATA[<p>I’m here at the <a href="http://www.microsoft.com/en-us/default.aspx">Microsoft</a> <a href="http://www.buildwindows.com/">BUILD</a> conference in Anaheim and am very much enjoying all the announcements surrouding the next major release of Windows (at least a year or two out).&#160; One of the big speculations that has drawn a lot of confusion over the past few months is whether .Net is going to part of the next generation of Windows.&#160; It seems that Microsoft had been telegraphing quite a bit about how C++ will be the language of choice to program going into the Microsoft future.</p>  <p>Well, I’m sure that .Net is a part of Windows 8. I also now know that if you want to continue to write c# or vb code for the “new” part of Windows 8 (Metro) you can, however Microsoft has created a new API they are calling WinRT.&#160;&#160; WinRT does have a full CLR and the languages c# and vb will be supported.&#160; However, the API you call has changed.&#160; Miguel has a great article that explains much of this here:&#160; <a title="http://tirania.org/blog/archive/2011/Sep-15.html" href="http://tirania.org/blog/archive/2011/Sep-15.html">http://tirania.org/blog/archive/2011/Sep-15.html</a></p>  <p>It’s a brave new world!&#160; Much has changed, much is the same.</p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/metro.jpg"><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="metro" border="0" alt="metro" src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/09/metro_thumb.jpg" width="244" height="184" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2011/09/15/winrt-in-windows-8-clr-confusion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>With ASP.NET WebForms, How to Keep / Stop a Data Control Like GridView From Retrieving Data</title>
		<link>http://peterkellner.net/2011/08/01/with-asp-net-webforms-how-to-keep-stop-a-data-control-like-gridview-from-retrieving-data/</link>
		<comments>http://peterkellner.net/2011/08/01/with-asp-net-webforms-how-to-keep-stop-a-data-control-like-gridview-from-retrieving-data/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 21:35:00 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>
		<category><![CDATA[ASP.NET 3.5]]></category>
		<category><![CDATA[ASP.NET 4.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[ObjectDataSource]]></category>
		<category><![CDATA[WebForms]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2011/08/01/with-asp-net-webforms-how-to-keep-stop-a-data-control-like-gridview-from-retrieving-data/</guid>
		<description><![CDATA[The What and Where  Something that may not be obvious is if are creating an asp.net WebForms project and you put a datasource such as SqlDataSource or ObjectDataSource for example on the page, how can you prevent the SqlSelect associated with that datasource from being triggered.  The answer is to set the control’s [...]]]></description>
			<content:encoded><![CDATA[<h2>The What and Where</h2>  <p>Something that may not be obvious is if are creating an asp.net <a href="http://msdn.microsoft.com/en-us/library/ms973868.aspx">WebForms</a> project and you put a datasource such as <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.aspx">SqlDataSource</a> or <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.aspx">ObjectDataSource</a> for example on the page, how can you prevent the SqlSelect associated with that datasource from being triggered.</p>  <p>The answer is to set the control’s visible property to false.&#160; That’s it!</p>  <span id="more-1529"></span>  <p>&#160;</p>  <h2>The Why</h2>  <p>The reason you might want to do this is for a case where you have a public facing web page that might be easily subjected to a denial of service attach.&#160; If that web page is always causing some SqlDataSource to fire, you could easily find your <a href="http://www.microsoft.com/sqlserver/en/us/default.aspx">SqlServer</a> overloaded.&#160; At least by checking to see a user is logged in before firing the sql statement, you buy yourself a little bit of protection.</p>  <p>&#160;</p>  <h2>The Code</h2>  <pre class="csharpcode"><span class="asp">&lt;%@ Page Language=&quot;C#&quot; %&gt;</span>

<span class="kwrd">&lt;!</span><span class="html">DOCTYPE</span> <span class="attr">html</span> <span class="attr">PUBLIC</span> <span class="kwrd">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> 
<span class="kwrd">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span class="kwrd">&gt;</span>

<span class="kwrd">&lt;</span><span class="html">script</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">&gt;</span>

    <span class="kwrd">protected</span> <span class="kwrd">void</span> 
        GridView1_SelectedIndexChanged(<span class="kwrd">object</span> sender, EventArgs e)
    {

    }

    <span class="kwrd">protected</span> <span class="kwrd">void</span> Page_Init(<span class="kwrd">object</span> sender, EventArgs e)
    {
        <span class="kwrd">if</span> (!Context.User.Identity.IsAuthenticated)
        {
            GridView1.Visible = <span class="kwrd">false</span>;
        }
    }
<span class="kwrd">&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span>

<span class="kwrd">&lt;</span><span class="html">html</span> <span class="attr">xmlns</span><span class="kwrd">=&quot;http://www.w3.org/1999/xhtml&quot;</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">head</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">title</span><span class="kwrd">&gt;&lt;/</span><span class="html">title</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">body</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">form</span> <span class="attr">id</span><span class="kwrd">=&quot;form1&quot;</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">div</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">asp:SqlDataSource</span> <span class="attr">ID</span><span class="kwrd">=&quot;SqlDataSource1&quot;</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span> 
            <span class="attr">ConnectionString</span><span class="kwrd">=&quot;&lt;%$ ConnectionStrings:CodeCampSV06 %&gt;&quot;</span> 
            <span class="attr">SelectCommand</span>=
            <span class="kwrd">&quot;SELECT [Id], [Username], [Email] FROM [Attendees] ORDER BY [Id] DESC&quot;</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">asp:SqlDataSource</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">asp:GridView</span> <span class="attr">ID</span><span class="kwrd">=&quot;GridView1&quot;</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span> <span class="attr">AutoGenerateColumns</span><span class="kwrd">=&quot;False&quot;</span> 
            <span class="attr">DataKeyNames</span><span class="kwrd">=&quot;Id&quot;</span> <span class="attr">DataSourceID</span><span class="kwrd">=&quot;SqlDataSource1&quot;</span> 
            <span class="attr">onselectedindexchanged</span><span class="kwrd">=&quot;GridView1_SelectedIndexChanged&quot;</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Columns</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">asp:BoundField</span> <span class="attr">DataField</span><span class="kwrd">=&quot;Id&quot;</span> <span class="attr">HeaderText</span><span class="kwrd">=&quot;Id&quot;</span> <span class="attr">InsertVisible</span><span class="kwrd">=&quot;False&quot;</span> 
                    <span class="attr">ReadOnly</span><span class="kwrd">=&quot;True&quot;</span> <span class="attr">SortExpression</span><span class="kwrd">=&quot;Id&quot;</span> <span class="kwrd">/&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">asp:BoundField</span> <span class="attr">DataField</span><span class="kwrd">=&quot;Username&quot;</span> <span class="attr">HeaderText</span><span class="kwrd">=&quot;Username&quot;</span> 
                    <span class="attr">SortExpression</span><span class="kwrd">=&quot;Username&quot;</span> <span class="kwrd">/&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">asp:BoundField</span> <span class="attr">DataField</span><span class="kwrd">=&quot;Email&quot;</span> <span class="attr">HeaderText</span><span class="kwrd">=&quot;Email&quot;</span> 
                <span class="attr">SortExpression</span><span class="kwrd">=&quot;Email&quot;</span> <span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">Columns</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">asp:GridView</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">form</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">body</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">html</span><span class="kwrd">&gt;</span></pre>
<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>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2011/08/01/with-asp-net-webforms-how-to-keep-stop-a-data-control-like-gridview-from-retrieving-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Format Bytes in GridView Using ASP.NET (Custom asp:BoundField Server Control)</title>
		<link>http://peterkellner.net/2010/11/04/how-to-format-bytes-in-gridview-using-asp-net-custom-aspboundfield-server-control/</link>
		<comments>http://peterkellner.net/2010/11/04/how-to-format-bytes-in-gridview-using-asp-net-custom-aspboundfield-server-control/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 15:35:09 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2010/11/04/how-to-format-bytes-in-gridview-using-asp-net-custom-aspboundfield-server-control/</guid>
		<description><![CDATA[&#160;  (AKA, how to not use templates to do a simple GridView Column Formatting)   &#160;  This post is inspired by another post on did on GridView date formatting years ago.&#160; It’s still very popular.  If you are like me, you don’t like using GridView Templates because it makes you write [...]]]></description>
			<content:encoded><![CDATA[<h3>&#160;</h3>  <h2>(AKA, how to not use templates to do a simple GridView Column Formatting) </h2>  <p>&#160;</p>  <p>This post is inspired by another post on did on <a href="http://peterkellner.net/2006/05/24/how-to-set-a-date-format-in-gridview-using-aspnet-20using-htmlencode-property/">GridView date formatting</a> years ago.&#160; It’s still very popular.</p>  <p>If you are like me, you don’t like using <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx">GridView</a> Templates because it makes you write ugly verbose code.&#160; In this post, I’ll show you how to do a quick customization of the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.aspx">BoundField</a> asp.net&#160; server control.&#160; That is, the one you typically see in GridView as follows:</p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/d5424563765f_7094/image.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/d5424563765f_7094/image_thumb.png" width="244" height="90" /></a></p>  <p>What we plan to do, is to create a custom control that looks like the following:</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/d5424563765f_7094/image_3.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/d5424563765f_7094/image_thumb_3.png" width="511" height="102" /></a></p>  <p>and will end up displaying data in a table that looks like the following:</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/d5424563765f_7094/image_4.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/d5424563765f_7094/image_thumb_4.png" width="447" height="208" /></a></p>  <span id="more-1385"></span>  <p>So, one approach could be to simply convert the second column into a template with GridView and build a function to call that converts the column from numbers like 267030000 to 267.3 MB.&#160; To do that, the code on the GridView will look like the following:</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/d5424563765f_7094/image_5.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/d5424563765f_7094/image_thumb_5.png" width="616" height="193" /></a></p>  <p>And, the code behind will be as follows:</p>  <p>&#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">namespace</span> GridViewExtendedBoundField<br />{<br />    <span style="color: #0000ff">public</span> <span style="color: #0000ff">partial</span> <span style="color: #0000ff">class</span> WebForm2 : System.Web.UI.Page<br />    {<br />        <span style="color: #0000ff">protected</span> <span style="color: #0000ff">void</span> Page_Load(<span style="color: #0000ff">object</span> sender, EventArgs e)<br />        {<br /><br />        }<br /><br />        <span style="color: #0000ff">protected</span> <span style="color: #0000ff">string</span> FormatToBytes(<span style="color: #0000ff">long</span> bytes)<br />        {<br />            <span style="color: #0000ff">return</span> FormatBytes(bytes);<br />        }<br /><br />        <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> FormatBytes(<span style="color: #0000ff">long</span> bytes)<br />        {<br />            <span style="color: #0000ff">const</span> <span style="color: #0000ff">int</span> scale = 1024;<br />            var orders = <span style="color: #0000ff">new</span> <span style="color: #0000ff">string</span>[] { <span style="color: #006080">&quot;GB&quot;</span>, <span style="color: #006080">&quot;MB&quot;</span>, <span style="color: #006080">&quot;KB&quot;</span>, <span style="color: #006080">&quot;Bytes&quot;</span> };<br />            var max = (<span style="color: #0000ff">long</span>)Math.Pow(scale, orders.Length - 1);<br />            <span style="color: #0000ff">foreach</span> (<span style="color: #0000ff">string</span> order <span style="color: #0000ff">in</span> orders)<br />            {<br />                <span style="color: #0000ff">if</span> (bytes &gt; max)<br />                    <span style="color: #0000ff">return</span> <span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0:##.##} {1}&quot;</span>, <span style="color: #0000ff">decimal</span>.Divide(bytes, max), order);<br />                max /= scale;<br />            }<br />            <span style="color: #0000ff">return</span> <span style="color: #006080">&quot;0 Bytes&quot;</span>;<br />        }<br />    }<br />}</pre>
</div>

<div>(Code Copied from <a title="http://sharpertutorials.com/pretty-format-bytes-kb-mb-gb/" href="http://sharpertutorials.com/pretty-format-bytes-kb-mb-gb/">http://sharpertutorials.com/pretty-format-bytes-kb-mb-gb/</a>)</div>

<div>&#160;</div>

<div>This is OK for a one time use, but if you plan on doing this kind of thing a lot, I think a better way to do it is to override the BoundField control with a custom server control.&#160; Then, the code you write will look like the following and you will not need any code behind.</div>

<div>&#160;</div>

<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="background-color: #ffff00">&lt;%@ Register Assembly=&quot;CustomControls&quot;  Namespace=&quot;BoundControls&quot; TagPrefix=&quot;cc1&quot; %&gt;</span><br />...<br /><span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:GridView</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;GridView1&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span> <span style="color: #ff0000">AutoGenerateColumns</span><span style="color: #0000ff">=&quot;False&quot;</span> <br />           <span style="color: #ff0000">DataKeyNames</span><span style="color: #0000ff">=&quot;Id,Bytes&quot;</span> <span style="color: #ff0000">DataSourceID</span><span style="color: #0000ff">=&quot;ObjectDataSource1&quot;</span><span style="color: #0000ff">&gt;</span><br />  <span style="color: #0000ff">&lt;</span><span style="color: #800000">Columns</span><span style="color: #0000ff">&gt;</span><br />    <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:BoundField</span> <span style="color: #ff0000">DataField</span><span style="color: #0000ff">=&quot;Id&quot;</span> <span style="color: #ff0000">HeaderText</span><span style="color: #0000ff">=&quot;Id&quot;</span> <span style="color: #ff0000">ReadOnly</span><span style="color: #0000ff">=&quot;True&quot;</span> <br />       <span style="color: #ff0000">SortExpression</span><span style="color: #0000ff">=&quot;Id&quot;</span> <span style="color: #0000ff">/&gt;</span><br />    <span style="color: #0000ff">&lt;</span><span style="color: #800000">cc1:BoundFieldBytesDisplay</span> <span style="color: #ff0000">DataField</span><span style="color: #0000ff">=&quot;Bytes&quot;</span> <span style="color: #ff0000">FormatAsFancyBytes</span><span style="color: #0000ff">=&quot;true&quot;</span>   <span style="color: #0000ff">&gt;</span><br />    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">cc1:BoundFieldBytesDisplay</span><span style="color: #0000ff">&gt;</span></pre>

  <br /></div>

<p>The actual custom control you have to include is simply in library reference by the Assembly CustomControls (where you can put other stuff like this).&#160; That code is as follows:</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> System;<br /><span style="color: #0000ff">using</span> System.Web.UI.WebControls;<br /><br /><span style="color: #0000ff">namespace</span> BoundControls<br />{<br />    <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> BoundFieldBytesDisplay : BoundField<br />    {<br />        <span style="color: #0000ff">public</span> <span style="color: #0000ff">bool</span> FormatAsFancyBytes<br />        {<br />            get<br />            {<br />                <span style="color: #0000ff">if</span> (ViewState[<span style="color: #006080">&quot;FormatAsFancyBytes&quot;</span>] == <span style="color: #0000ff">null</span>)<br />                {<br />                    <span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span>;<br />                }<br />                <span style="color: #0000ff">return</span> (<span style="color: #0000ff">bool</span>) ViewState[<span style="color: #006080">&quot;FormatAsFancyBytes&quot;</span>];<br />            }<br />            set { ViewState[<span style="color: #006080">&quot;FormatAsFancyBytes&quot;</span>] = <span style="color: #0000ff">value</span>; }<br />        }<br /><br />        <span style="color: #0000ff">protected</span> <span style="color: #0000ff">override</span> <span style="color: #0000ff">string</span> FormatDataValue(<span style="color: #0000ff">object</span> dataValue, <span style="color: #0000ff">bool</span> encode)<br />        {<br />            <span style="color: #0000ff">if</span> (!FormatAsFancyBytes)<br />            {<br />                <span style="color: #0000ff">return</span> <span style="color: #0000ff">base</span>.FormatDataValue(dataValue, encode);<br />            }<br />            <span style="color: #0000ff">else</span><br />            {<br />                <span style="color: #0000ff">return</span> FormatBytes(Convert.ToInt64(dataValue));<br />            }<br />        }<br /><br />        <span style="color: #008000">/// &lt;summary&gt;</span><br />        <span style="color: #008000">/// http://sharpertutorials.com/pretty-format-bytes-kb-mb-gb/</span><br />        <span style="color: #008000">/// &lt;/summary&gt;</span><br />        <span style="color: #008000">/// &lt;param name=&quot;bytes&quot;&gt;&lt;/param&gt;</span><br />        <span style="color: #008000">/// &lt;returns&gt;&lt;/returns&gt;</span><br />        <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> FormatBytes(<span style="color: #0000ff">long</span> bytes)<br />        {<br />            <span style="color: #0000ff">const</span> <span style="color: #0000ff">int</span> scale = 1024;<br />            var orders = <span style="color: #0000ff">new</span>[] {<span style="color: #006080">&quot;GB&quot;</span>, <span style="color: #006080">&quot;MB&quot;</span>, <span style="color: #006080">&quot;KB&quot;</span>, <span style="color: #006080">&quot;Bytes&quot;</span>};<br />            var max = (<span style="color: #0000ff">long</span>) Math.Pow(scale, orders.Length - 1);<br />            <span style="color: #0000ff">foreach</span> (<span style="color: #0000ff">string</span> order <span style="color: #0000ff">in</span> orders)<br />            {<br />                <span style="color: #0000ff">if</span> (bytes &gt; max)<br />                    <span style="color: #0000ff">return</span> <span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;{0:##.##} {1}&quot;</span>, <span style="color: #0000ff">decimal</span>.Divide(bytes, max), order);<br />                max /= scale;<br />            }<br />            <span style="color: #0000ff">return</span> <span style="color: #006080">&quot;0 Bytes&quot;</span>;<br />        }<br />    }<br />}</pre>

  <br /></div>

<p>That’s basically it!&#160; Notice that in the custom control, all we have done is defined a property named “FormatAsFancyBytes” so we can set that to true.&#160; Once that happens, we simply call the FormatBytes method and it does the job we expect. If we have “FormatAsFancyBytes” false, or left out, then this control will perform identically to a BoundField control because we are calling the base class.</p>

<p>Keep in mind, you can add all kinds of special properties now to this control to handle all sorts of formatting that might be common to your business.</p>

<p>Here is the sample project build with <a href="http://www.microsoft.com/visualstudio/en-us/products/2010-editions">Visual Studio 2010</a> that demonstrates the above code.</p>

<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:be9f8e87-2126-42ee-8fb2-1686a3d99203" class="wlWriterEditableSmartContent"><p><div>Visual Studio 2010 Solution   <a href="http://peterkellner.net/FilesForWebDownload/d5424563765f_7094/GridViewExtendedBoundField.zip" target="_self">GridViewExtendedBoundField.zip</a></div></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:26eb3413-52b5-42d8-b591-be12a5b10f39" class="wlWriterEditableSmartContent"><p><div>Visual Studio 2010 Solution   <a href="http://peterkellner.net/FilesForWebDownload/d5424563765f_7094/GridViewExtendedBoundField_3.zip" target="_self">GridViewExtendedBoundField.zip</a></div></p></div>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2010/11/04/how-to-format-bytes-in-gridview-using-asp-net-custom-aspboundfield-server-control/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Basic RIA Services And DataGrid With VS 2010 Tooling (Article 2 of 7)</title>
		<link>http://peterkellner.net/2010/01/25/basic-ria-services-and-datagrid-with-vs-2010-tooling-article-2-of-7/</link>
		<comments>http://peterkellner.net/2010/01/25/basic-ria-services-and-datagrid-with-vs-2010-tooling-article-2-of-7/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 22:51:23 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[ASP.NET 2.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[RIA Services]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2010/01/25/basic-ria-services-and-datagrid-with-vs-2010-tooling-article-2-of-7/</guid>
		<description><![CDATA[              &#160;        Title Of Each Article        Video Included With Each Post                  [...]]]></description>
			<content:encoded><![CDATA[<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="/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="/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="/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="/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="/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="/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="/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>  <br />  <br /><img src="http://video.peterkellner.net/video/RIAServicesBayNet20090120/P2_BasicRIANoTooling_Thumb.jpg" alt="media" /><br />
  <p>&#160;</p>  <p>In this article, we will&#160; build from scratch, using Visual Studio 2010 Beta 2 a simple application that lets us view <a href="http://www.siliconvalley-codecamp.com/">Silicon Valley Code Camp</a> Attendees that have authorized us to share their data.&#160; We will be using no special RIA Services Visual Studio 2010 design tools to do this.&#160; We will:</p>  <ul>   <li>Create the <a href="http://msdn.microsoft.com/en-us/library/aa697427(VS.80).aspx">Entity Framework</a> Repository </li>    <li>Create the Domain Service </li>    <li>Wire up an Appropriate Get Method that Returns in <a href="http://msdn.microsoft.com/en-us/library/system.linq.iqueryable.aspx">IQueryable</a> </li>    <li>Call From the Client Code the Domain Service </li>    <li>Show The Results </li>    <li>Observations </li> </ul>  <p>First, we need to create a new Visual Studio Project.&#160; We do that by using the File/New Project and chose “Silverlight Business Application”.</p> <span id="more-478"></span>  <p><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb.png" width="441" height="246" /></a></p>  <h2>Create The Entity Framework</h2>  <p>Then, we need to create an Entity Framework Repository that will be the target of our Domain Service.&#160; We do that by adding to the web project (not the top, <a href="http://silverlight.net/">Silverlight</a> project), we just created and “ADO.NET Entity Data Model”.&#160; We’ll call it ModelSVCC for Model Silicon Valley Code Camp.</p>  <p><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_3.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_3.png" width="456" height="258" /></a></p>  <p>We use the option “Generate From Database” as follows:</p>  <p><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_4.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_4.png" width="320" height="284" /></a></p>  <p>Choose the appropriate connection (in our case svcodecamp on our local Sql Server 2008 database).</p>  <p><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_5.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_5.png" width="343" height="305" /></a></p>  <p>For simplicity, choose all tables and views as follows.</p>  <p><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_6.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_6.png" width="340" height="302" /></a></p>  <p>Do a Rebuild/All to make sure all the template code get’s generated and we are done with our first step.</p>  <h2>Create the Domain Service</h2>  <p>Next, create the Domain Service.&#160; This is done by adding again to the web project the Domain Service as follows.</p>  <p><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_7.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_7.png" width="372" height="211" /></a></p>  <p>Name it DomainServiceSVCC.cs again for Silicon Valley Code Camp.</p>  <p>Next check all tables and views, make sure “Enable Client Access” is checked and also “Generate associated classes for meta data”.&#160; Enable Client Access adds an attribute to the generated domain class which tell Visual Studio (on building) to generate the same domain classes on the client (Silverlight) side.&#160; This means that you are writing both your client and server code at the same time!&#160; Very convenient.</p>  <p><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_8.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_8.png" width="259" height="316" /></a> <a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_9.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_9.png" width="354" height="189" /></a></p>  <p>Now, to the method generated in the Domain Service class add an OrderBy Linq command so that the method GetAttendeesWithShare has an implicit order and Skip and Take LINQ will work and the total number of records can be easily obtained (notice the yellow highlighing is the code we added, the rest was there before).</p>  <p><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_10.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_10.png" width="623" height="166" /></a></p>  <p>Finally, Rebuild/All again and we are done creating the domain service class for this example.</p>  <h2>Wire up an Appropriate Get Method that Returns in IQueryable</h2>  <p>Now that we have our Domain Service built on the Server side (and of course it get’s exposed on the client side with Visual Studio 2010 template generating magic), we can go to one of the pages built in the default template, add a Silverlight DataGrid and assign our Domain Context to that. Let’s add the list of attendees to our Home Page.&#160; We do that by going to the View\Home.xaml file and simply add a DataGrid tag to the page (see below highlighted in yellow, we simply typed that in or could have dragged it from the toolbar if we are so included).</p>  <p><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_11.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_11.png" width="429" height="376" /></a></p>  <p>Then, we go to the code behind of this page and add the following code to the “OnNavigateTo” enent of the Home.xaml page.</p>  <pre class="csharpcode"> var context = <span class="kwrd">new</span> DomainServiceSVCC();
 dataGrid1.ItemsSource = context.AttendeesWithShares;
 context.Load(context.GetAttendeesWithSharesQuery());</pre>

<p>
  <br /></p>
<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><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_12.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_12.png" width="502" height="147" /></a></p>

<p>Now, when we rebuild all and run, we get:</p>

<p><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_13.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_13.png" width="317" height="172" /></a></p>

<p>When we click on the Id’s column header, we get the data sorted in reverse Id order, even though we never code an event for that!</p>

<p><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_14.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_14.png" width="317" height="172" /></a></p>

<h2>Observations</h2>

<p>So, what have we done?&#160; Well, we’ve done a lot. first, we’ve create a Domain Service that uses WCF on the server side.&#160; We created code on the Silverlight client that called this domain service.&#160; We got databinding right through to our output.&#160; Be very clear that in our code we added to the OnNavigate Event (repeated here)</p>

<p><a href="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_12.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="/FilesForWebDownload/BasicRIAWithMinimalVS2010ToolingArticle2_DD97/image_thumb_12.png" width="322" height="96" /></a></p>

<p>we made a clear step across the network boundary.&#160; We created the DataService context and when we loaded it, all the async magic just happened for us.&#160; No wsdl’s, proxies to code, keep updated, etc.&#160; All that actually happens for us, but we don’t have to worry about it.&#160; I think I’m in love.</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2010/01/25/basic-ria-services-and-datagrid-with-vs-2010-tooling-article-2-of-7/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	<enclosure url="http://video.peterkellner.net/video/RIAServicesBayNet20090120/P2_BasicRIANoTooling.flv" length="1" type="video/x-flv"/>
	</item>
		<item>
		<title>Adding A DataGrid With Connect The Dots DataBinding in VS 2010 (Article 3 of 7)</title>
		<link>http://peterkellner.net/2010/01/23/adding-a-datagrid-with-connect-the-dots-databinding-in-vs-2010-article-3-of-7/</link>
		<comments>http://peterkellner.net/2010/01/23/adding-a-datagrid-with-connect-the-dots-databinding-in-vs-2010-article-3-of-7/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 19:41:20 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[ASP.NET 2.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[RIA Services]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[VS2010]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>

		<guid isPermaLink="false">http://peterkellner.net/?p=461</guid>
		<description><![CDATA[    &#160; Title Of Each Article Video Included With Each Post  Part 1 Introduction To RIA Services In Silverlight (This Article) 7 Minutes  Part 2 Basic RIA Services And DataGrid With&#160; VS 2010 Tooling 14 Minutes  Part 3 Adding A DataGrid With Connect The Dots DataBinding in VS 2010 [...]]]></description>
			<content:encoded><![CDATA[<br /> <table width="90%"> <tbody> <tr> <td width="70">&nbsp;</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="/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="/2010/01/25/basic-ria-services-and-datagrid-with-vs-2010-tooling-article-2-of-7/">Basic RIA Services And DataGrid With&nbsp; 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="/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="/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="/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="/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="/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><br /> <br /><img src="http://video.peterkellner.net//video/RIAServicesBayNet20090120/P3_DataGridWithVSToolingBusyIndicatorAndPaging_Thumb.jpg" alt="media" /><br />
<br /> <p>In this article, we will use the the Visual Studio 2010 Beta2 Tooling to create a Sessions DataGrid.&nbsp; We will add a Pager to it as well as a Silverlight busy indicator which will show while the data is loading.&nbsp; In Article 1, we build a simple DataGrid with code behind, in this article, it will all be declarative in XAML built with the Visual Studio 2010 designer.</p><span id="more-461"></span> <p>First thing we need to do is add a new Silverlight Navigation Page to the Silverlight project (not the web project) in the Views folder.</p> <p>&nbsp;<a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb.png" width="433" height="183"></a></p> <p>Then, copy the code from the Home Page to get the top two default sections that appear on every page as follows:</p> <p>&nbsp;<a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_3.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_3.png" width="437" height="163"></a></p> <p>And the actual code:</p><!-- code formatted by http://manoli.net/csharpformat/ --> <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> <pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">StackPanel</span> <span class="attr">x:Name</span><span class="kwrd">="ContentStackPanel"</span>
            <span class="attr">Style</span><span class="kwrd">="{StaticResource ContentStackPanelStyle}"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">TextBlock</span> <span class="attr">x:Name</span><span class="kwrd">="HeaderText"</span> <span class="attr">Style</span><span class="kwrd">="{StaticResource HeaderTextStyle}"</span>
               <span class="attr">Text</span><span class="kwrd">="{Binding Path=ApplicationStrings.HomePageTitle,
               Source={StaticResource ResourceWrapper}}"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">TextBlock</span> <span class="attr">x:Name</span><span class="kwrd">="ContentText"</span> <span class="attr">Style</span><span class="kwrd">="{StaticResource ContentTextStyle}"</span>
               <span class="attr">Text</span><span class="kwrd">="Home page content"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Image</span> <span class="attr">Height</span><span class="kwrd">="393"</span> <span class="attr">Name</span><span class="kwrd">="image1"</span> <span class="attr">Stretch</span><span class="kwrd">="Uniform"</span> <span class="attr">Width</span><span class="kwrd">="467"</span>
               <span class="attr">Source</span><span class="kwrd">="/Presentation1;component/Images/IMG_1504.JPG"</span> <span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">StackPanel</span><span class="kwrd">&gt;</span></pre>
<p>Change text to “Speaker page content” and change the resource string to ApplicationString.SpeakerPageTitle and update the ApplicationStrings.resx file as follows:</p>
<p>&nbsp;<a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_4.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_4.png" width="405" height="286"></a></p>
<p>Then, drag a DataGrid to the Speaker.xaml design surface (after removing the image tag which was the picture on the home page we copied over).</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_5.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_5.png" width="549" height="213"></a></p>
<p>Now, we do what Microsoft calls “Connect the Dots DataBinding”.&nbsp; That is, we go to the Data Sources Tab</p>
<p>&nbsp;<a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_6.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_6.png" width="352" height="168"></a></p>
<p>Drag the SpeakersShort2009 box (shown in yellow below) to the DataGrid showing on the design surface.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_7.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_7.png" width="348" height="149"></a></p>
<p>That automatically creates a bunch of xaml including the RIA Domain DataSource, which includes a reference to the correct query method and the correct Domain Context.&nbsp; Very nice!</p>
<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>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">riaControls:DomainDataSource</span> <span class="attr">AutoLoad</span><span class="kwrd">="True"</span> <span class="attr">Height</span><span class="kwrd">="0"</span>
                                      <span class="attr">LoadedData</span><span class="kwrd">="speakersShort2009DomainDataSource_LoadedData"</span>
                                      <span class="attr">Name</span><span class="kwrd">="speakersShort2009DomainDataSource"</span>
                                      <span class="attr">QueryName</span><span class="kwrd">="GetSpeakersShort2009Query"</span> <span class="attr">Width</span><span class="kwrd">="0"</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">riaControls:DomainDataSource.DomainContext</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">my:DomainServiceSVCC</span> <span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">riaControls:DomainDataSource.DomainContext</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">riaControls:DomainDataSource</span><span class="kwrd">&gt;</span></pre><br /><pre class="csharpcode"><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_8.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_8.png" width="599" height="195"></a></pre><pre class="csharpcode"></pre>
<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; } -->Now, we do the same thing with the DataPager (which may have to add to the toolbox with “Choose Items” That gives us some xaml that looks like the following.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_9.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_9.png" width="423" height="287"></a></p>
<p>&nbsp;</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_10.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_10.png" width="419" height="246"></a></p><pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">data:DataPager</span> <span class="attr">Height</span><span class="kwrd">="26"</span>
                <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="720,325,0,0"</span>
                <span class="attr">Name</span><span class="kwrd">="dataPager1"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="Top"</span>
                <span class="attr">Width</span><span class="kwrd">="200"</span>
                <span class="attr">PageSize</span><span class="kwrd">="10"</span><span class="kwrd">/&gt;</span></pre><pre class="csharpcode"><span class="kwrd"></span>&nbsp;</pre>
<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; } --></p>
<p>Notice that I put PageSize in.&nbsp; That does not happen by default, and in my presentation, I forgot this and for a while could not figure out why the paging was not working.&nbsp; Try and not make the same mistake!</p>
<p>Then, drag the same DataSource as we dragged to the DataGrid and drop it on the Paging control as follows:</p>
<p>&nbsp;<a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_11.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_11.png" width="412" height="135"></a></p>
<p>That automatically binds the DataPager to the same DomainDataSource as the DataGrid’s DomainDataSource.&nbsp; Here is the XAML created.</p><pre class="csharpcode"> <span class="kwrd">&lt;</span><span class="html">data:DataPager</span> <span class="attr">Height</span><span class="kwrd">="26"</span> <span class="attr">Name</span><span class="kwrd">="dataPager1"</span> <span class="attr">Width</span><span class="kwrd">="200"</span>
   <span class="attr">Source</span><span class="kwrd">="{Binding ElementName=speakersShort2009DomainDataSource, Path=Data}"</span> <span class="kwrd">/&gt;</span></pre><pre class="csharpcode"></pre>
<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; } -->The next thing is to use the new “Reset-All” for styling.&nbsp; It’s very simple.&nbsp; Right click on the design surface and simply click “Layout/Reset” as follows:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_12.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_12.png" width="244" height="176"></a></p>
<p>Now, when we run this, we get:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_13.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_13.png" width="380" height="366"></a></p>
<p>Finally, to put a “Busy Indicator” control on the page, we simply drag out the busy Indicator onto the design surface. It likely will not be in your toolbox, so like the DataPager, you will need to add it to the toolbar as follows:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_14.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_14.png" width="396" height="252"></a></p>
<p>Then, drag it from the toolbox right onto the DataGrid as follows:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_15.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_15.png" width="297" height="314"></a></p>
<p>Then, once it’s on the DataGrid (and in the XAML), you need to right click on it and change some of it’s properties.</p>
<p>First, set the “IsBusy” property by checking the checkbox, then resize the control itself so it shows the text and is a pleasant size.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_16.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_16.png" width="428" height="280"></a></p>
<p>The next step is a little more tricky.&nbsp; You need to find the property in the BusyIndicator called DataContext. Right click on that as follows and press “Apply Data Binding”.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_17.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_17.png" width="428" height="257"></a></p>
<p>Now, you are setting the Source so first select “ElementName”, then chose speakersShort2009DomainDataSource as follows:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_18.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_18.png" width="431" height="296"></a></p>
<p>Then, go to the “Path:” and set the property “DomainContext” and the method to “IsLoading” as follows:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_19.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_19.png" width="436" height="254"></a></p>
<p>What this has done is created a binding expression using a very nice Visual Studio 2010 Tool.&nbsp; It’s assigned that binding expression to the DataContext of the DomainDataSource.</p><pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">riaControls:DomainDataSource</span> <span class="attr">AutoLoad</span><span class="kwrd">="True"</span> <span class="attr">Height</span><span class="kwrd">="0"</span>
         <span class="attr">LoadedData</span><span class="kwrd">="speakersShort2009DomainDataSource_LoadedData_2"</span>
                              <span class="attr">Name</span><span class="kwrd">="speakersShort2009DomainDataSource"</span>
                              <span class="attr">QueryName</span><span class="kwrd">="GetSpeakersShort2009Query"</span> <span class="attr">Width</span><span class="kwrd">="0"</span>
   <span class="attr">DataContext</span><span class="kwrd">="{Binding ElementName=speakersShort2009DomainDataSource, Path=DomainContext.IsLoading}"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">riaControls:DomainDataSource.DomainContext</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">my:DomainServiceSVCC</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">riaControls:DomainDataSource.DomainContext</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">riaControls:DomainDataSource</span><span class="kwrd">&gt;</span></pre>
<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; } -->Now, when we finally run our program, we first get the busy indicator as the data is being asynchrously loaded which looks like this:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_20.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_20.png" width="514" height="180"></a></p>
<p>Then, when the data finally loads, looks like the following:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_21.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/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_21.png" width="523" height="449"></a></p>
<p>Notice the paging control at the bottom, and notice the BusyIndicator has gone away.</p>
<p>That’s it for this article.&nbsp; In the next article, we will style this page as well as add Converts to show the Speakers picture and add a hyperlink to the sessions associated with each speaker.</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2010/01/23/adding-a-datagrid-with-connect-the-dots-databinding-in-vs-2010-article-3-of-7/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	<enclosure url="http://video.peterkellner.net//video/RIAServicesBayNet20090120/P3_DataGridWithVSToolingBusyIndicatorAndPaging.flv" length="1" type="video/x-flv"/>
	</item>
		<item>
		<title>How to Get a Stack Trace from C# without throwing Exception</title>
		<link>http://peterkellner.net/2009/12/21/how-to-get-a-stack-trace-from-c-without-throwing-exception/</link>
		<comments>http://peterkellner.net/2009/12/21/how-to-get-a-stack-trace-from-c-without-throwing-exception/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 16:48:54 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/12/21/how-to-get-a-stack-trace-from-c-without-throwing-exception/</guid>
		<description><![CDATA[Say you have some logging in your code that finds something unusual going on.&#160; In my case, I have a DataContext that I check to make sure it’s not already open before I open it.&#160; The method that I call the DataContext in is a utility method that is buried many layers down.&#160; When this [...]]]></description>
			<content:encoded><![CDATA[<p>Say you have some logging in your code that finds something unusual going on.&#160; In my case, I have a DataContext that I check to make sure it’s not already open before I open it.&#160; The method that I call the DataContext in is a utility method that is buried many layers down.&#160; When this problem is found, I don’t want to throw an exception, but I do want to log where I was.&#160; It does not help me to know that I’m in my utility method.&#160; I need to know the <a href="http://msdn.microsoft.com/en-us/library/system.environment.stacktrace.aspx">stack</a>.</p> <span id="more-398"></span>  <p>Below is some simple code that lets me do this.&#160; Notice, it’s important to call <a href="http://msdn.microsoft.com/en-us/library/aa326974%28VS.71%29.aspx">StackTrace</a> with true, otherwise the line numbers don’t appear.</p>  <p>HTH’s!</p>  <pre class="csharpcode"><span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">using</span> System.Diagnostics;
<span class="kwrd">using</span> System.Linq;
<span class="kwrd">using</span> System.Text;

<span class="kwrd">namespace</span> ConsoleApplication1
{
    <span class="kwrd">class</span> Program
    {
        <span class="kwrd">static</span> <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[] args)
        {
            TestClass.GoNow();
        }
    }

    <span class="kwrd">class</span> TestClass
    {
        <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> GoNow()
        {
            var stackTrace = <span class="kwrd">new</span> StackTrace(<span class="kwrd">true</span>);
            <span class="kwrd">foreach</span> (var r <span class="kwrd">in</span> stackTrace.GetFrames())
            {
                Console.WriteLine(<span class="str">&quot;Filename: {0} Method: {1} Line: {2} Column: {3}  &quot;</span>,
                    r.GetFileName(),r.GetMethod(), r.GetFileLineNumber(),
                    r.GetFileColumnNumber() );
            }
        }
    }


}</pre>
<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>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/12/21/how-to-get-a-stack-trace-from-c-without-throwing-exception/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Long Live the Semicolon and Why I Love it!</title>
		<link>http://peterkellner.net/2009/10/24/usethesemicolonornot/</link>
		<comments>http://peterkellner.net/2009/10/24/usethesemicolonornot/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 15:23:55 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/10/24/usethesemicolonornot/</guid>
		<description><![CDATA[ OK, so we all want to be somewhat popular, and it seems that my last article, “To Brace Or Not to Brace”, seems to have gotten a lot of attention, so, here goes my opinion on the popular semi-colon argument.&#160; First, I’m not against any languages in particular, but I have found that I [...]]]></description>
			<content:encoded><![CDATA[<p> OK, so we all want to be somewhat popular, and it seems that my last article, <a href="http://peterkellner.net/2009/10/19/codingstandards-csharp-braces/">“To Brace Or Not to Brace”,</a> seems to have gotten a lot of attention, so, here goes my opinion on the popular semi-colon argument.&#160; First, I’m not against any languages in particular, but I have found that I do better in ones that have semi-colons.&#160; One of the features I really like is the ability to move my line returns anyplace I want, and to indent as I see fit.&#160; Though the semi-colon does not guarantee I can do this, it certainly makes life easier.</p> <span id="more-370"></span>  <p>So, what’s wrong with using tabs to signal nesting levels and dispense with semi-colons?&#160; Well, for me, that is just too hard.&#160; I always seem to mess up and my code stops working.&#160; What about line continuations?&#160; I just have to ask why?&#160; Want to continue, just press the return key.&#160; Not much else to remember.</p>  <p>In College, I learned a language called PL/1 (long forgotten) that required semi-colons.&#160; I remember the compiler would constantly spit out errors saying “Maybe you have missed your semi-colon?”.&#160; I use to find that very annoying, but now, that I’m a semicolon lover, I just happily type them at the end of each statement I want terminated.</p>  <p>There are dissenters however.&#160; For example, the TheMightyFavog says <a href="http://www.democraticunderground.com/discuss/duboard.php?az=view_all&amp;address=105x6098021">“Let’s get rid of it.&#160; Nobody knows how to use the thing anyway</a>”. </p>  <p>Just my 2 cents.</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/10/24/usethesemicolonornot/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Visiting Our First Silicon Valley Code Camp Platinum Sponsor for 2009</title>
		<link>http://peterkellner.net/2009/08/16/visiting-our-first-silicon-valley-code-camp-platinum-sponsor-for-2009/</link>
		<comments>http://peterkellner.net/2009/08/16/visiting-our-first-silicon-valley-code-camp-platinum-sponsor-for-2009/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 18:23:59 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/08/16/visiting-our-first-silicon-valley-code-camp-platinum-sponsor-for-2009/</guid>
		<description><![CDATA[ This past Thursday evening, my wife Tammy and I went to visit our first platinum sponsor of 2009, Falafel Software in Capitola California.&#160; Lino Tadros, Chairman and CEO of Falafel let us use his office for normal working during the day, then we all went out for a great Sushi meal after.&#160; Falafel provides [...]]]></description>
			<content:encoded><![CDATA[<p> This past Thursday evening, my wife Tammy and I went to visit our first platinum sponsor of 2009, <a href="http://www.falafel.com/">Falafel Software</a> in Capitola California.&#160; Lino Tadros, Chairman and CEO of Falafel let us use his office for normal working during the day, then we all went out for a great Sushi meal after.&#160; Falafel provides high qualtiy software development, consulting and training.&#160; We had the chance to see where it all happens.</p> <span id="more-343"></span>  <p><a href="http://www.siliconvalley-codecamp.com">http://www.siliconvalley-codecamp.com</a> (come!)</p>  <p>Thanks for hosting!</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/VisitingOurFirstSiliconValleyCodeCampPla_9EFC/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/VisitingOurFirstSiliconValleyCodeCampPla_9EFC/image_thumb.png" width="244" height="164" /></a> <a href="http://peterkellner.net/FilesForWebDownload/VisitingOurFirstSiliconValleyCodeCampPla_9EFC/image_3.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/VisitingOurFirstSiliconValleyCodeCampPla_9EFC/image_thumb_3.png" width="244" height="243" /></a></p>  <p>At Gayles Deli, then in the Falafel Office</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/08/16/visiting-our-first-silicon-valley-code-camp-platinum-sponsor-for-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bravo for ORCSWeb! On so many fronts</title>
		<link>http://peterkellner.net/2009/07/27/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[Sql Server]]></category>
		<category><![CDATA[Sql Server 2008]]></category>
		<category><![CDATA[hosting]]></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> <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>In ASP.NET, How To Create a DropDownList from an ENUM</title>
		<link>http://peterkellner.net/2009/06/16/in-aspnet-how-to-create-a-dropdownlist-from-an-enum/</link>
		<comments>http://peterkellner.net/2009/06/16/in-aspnet-how-to-create-a-dropdownlist-from-an-enum/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 23:05:14 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>
		<category><![CDATA[ASP.NET 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/06/16/in-aspnet-how-to-create-a-dropdownlist-from-an-enum/</guid>
		<description><![CDATA[ So, you have an enum defined as follows:  public enum CompanyAddressType
    {
        Unknown = 0,
        Primary = 1,
        Warehouse = 2,
        Distribution_Center [...]]]></description>
			<content:encoded><![CDATA[<p> So, you have an enum defined as follows:</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">enum</span> CompanyAddressType
    {
        Unknown = 0,
        Primary = 1,
        Warehouse = 2,
        Distribution_Center = 3,
        Cross_Dock = 4
    }</pre>

<p>You want to iterate through the list and put the data into an asp.net dropdownlist.</p>
<span id="more-326"></span>

<p></p>

<p>Here is the simple code:</p>

<pre class="csharpcode"><span class="kwrd">protected</span> <span class="kwrd">void</span> Page_Load(<span class="kwrd">object</span> sender, EventArgs e)
        {
            <span class="kwrd">if</span> (!IsPostBack)
            {
                <span class="kwrd">string</span>[] names = Enum.GetNames(<span class="kwrd">typeof</span>(CompanyAddressType));
                var values = (CompanyAddressType[])Enum.GetValues(<span class="kwrd">typeof</span>(CompanyAddressType));
                <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; names.Length; i++)
                {
                    DropDownListCompanyAddressType.Items.Add(<span class="kwrd">new</span> ListItem(names[i], values.ToString()));
                }
            }
        }</pre>

<p>&#160;</p>

<p>There are probably easier ways to do it, but this works.</p>

<p>and…</p>

<p><a href="http://peterkellner.net/FilesForWebDownload/InA.NETHowToCreateaDropDownListfromanENU_E21B/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/InA.NETHowToCreateaDropDownListfromanENU_E21B/image_thumb.png" width="246" height="154" /></a></p>

<p>HTH’s.</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/06/16/in-aspnet-how-to-create-a-dropdownlist-from-an-enum/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>780 Requests Per Second Verses 110, You Really Need to Compile your LINQ to SQL (LINQ2SQL) Queries</title>
		<link>http://peterkellner.net/2009/06/08/linq2sql-uncompiled-verses-compiled-iis-performance-aspnet/</link>
		<comments>http://peterkellner.net/2009/06/08/linq2sql-uncompiled-verses-compiled-iis-performance-aspnet/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 05:21:49 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[LINQ to SQL]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/06/08/linq2sql-uncompiled-verses-compiled-iis-performance-aspnet/</guid>
		<description><![CDATA[*Note 10/22/2011 (2+ years later):&#160; Microsoft is fixing this problem in EntityFramework 4.5!&#160; See my post here about it: http://peterkellner.net/2011/10/22/microsoft-to-add-auto-compiled-linq-queries-to-entity-framework-v-next/  &#160;  


   If you have a problem like this involving ASP.NET, LINQ, EF, etc., consulting services are available.  We love these kind of problems.  Contact Peter Kellner and his [...]]]></description>
			<content:encoded><![CDATA[<p><font style="background-color: #ffff00">*Note 10/22/2011 (2+ years later):&#160; Microsoft is fixing this problem in EntityFramework 4.5!&#160; See my post here about it:</font> <a href="http://peterkellner.net/2011/10/22/microsoft-to-add-auto-compiled-linq-queries-to-entity-framework-v-next/"><font style="background-color: #ffff00">http://peterkellner.net/2011/10/22/microsoft-to-add-auto-compiled-linq-queries-to-entity-framework-v-next/</font></a></p>  <p>&#160;</p>  

<div>
  <div class="peterkellnerpromo"> <a href="/contactus" target="_blank">If you have a problem like this involving ASP.NET, LINQ, EF, etc., consulting services are available.  We love these kind of problems.  Contact Peter Kellner and his associates <span>here</span></a>. </div> 
  <div>

<p>So, I’ve been on kind of a rant lately about how slow <a href="http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx">LINQ2SQL</a> is if you don’t compile your queries before executing them.&#160; To be fair, if you are doing Windows Forms Programming, WPF or <a href="http://silverlight.net/">Silverlight</a> it really does not have much impact.&#160; The reason is that a very complex LINQ query may take 50 milliseconds (1/20th of a second).&#160; No big deal if you just have a dozen or so of them to do.&#160; The story changes though if you are using LINQ2SQL in a web environment that has limited CPU resources.&#160; That is, unless you have unlimited money, if it takes more than one web server to handle your load, your throwing away money by using <a href="http://jdconley.com/blog/archive/2007/11/28/linq-to-sql-surprise-performance-hit.aspx">uncompiled LINQ2SQL</a>.</p>  <p>So, to put some more substance behind my claims, I’ve written a small test application using Visual Studio 2008 that compares the performance of using LINQ2SQL compiled verses non-compiled on a trivial web page.</p>   
</div>
</div>

 
<span id="more-318"></span>
    <p>Here are some assumptions:</p>  <ul>   <li>My Notebook Computer Simulates a real world web server (Lenovo W500, Vista64, IIS7) </li>    <li>All Web Pages do 7 LINQ2SQL executions (Heading speak at&#160; VSLive in Vegas so 7 seemed right) </li>    <li>All Web Requests Do Only LINQ2SQL, no images, css, JavaScript or anything else </li> </ul>  <p>OK, maybe my assumptions are not so good, but I believe overall I’m making a good point so I’m going to keep going rather than just say “take my word for it, trust me”.&#160; So, I’m attaching the web project here that let’s you recreate all this so you can do your own tests.&#160; I think you’ll need Visual Studio Team Suite to do these tests.&#160; If you don’t have that, you can at least look at the code.&#160; The guts are in LINQUtils.cs.&#160; I’m going to show the relevant code below.</p>  <p>But before that, here is the Visual Studio 2008 Project Code if you want to try it yourself: </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:b2b30af6-cfd4-413d-abeb-71e63d4120bf" class="wlWriterSmartContent">   <p>Download: <a href="/FilesForWebDownload/780RequestsPerSecondVerses110YouReallyNe_F121/LINQ2SQL_CompiledQueryWebTest.zip" target="_blank">Project Zip File</a></p> </div>  <p>First, The Results</p>  <table border="0" cellspacing="0" cellpadding="2" width="400"><tbody>     <tr>       <td valign="top" width="200"><a href="http://peterkellner.net/FilesForWebDownload/780RequestsPerSecondVerses110YouReallyNe_F121/notcompiled.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="notcompiled" border="0" alt="notcompiled" src="http://peterkellner.net/FilesForWebDownload/780RequestsPerSecondVerses110YouReallyNe_F121/notcompiled_thumb.png" width="412" height="237" /></a> </td>        <td valign="top" width="200"><a href="http://peterkellner.net/FilesForWebDownload/780RequestsPerSecondVerses110YouReallyNe_F121/notcompiled1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="notcompiled1" border="0" alt="notcompiled1" src="http://peterkellner.net/FilesForWebDownload/780RequestsPerSecondVerses110YouReallyNe_F121/notcompiled1_thumb.png" width="250" height="236" /></a> </td>     </tr>      <tr>       <td valign="top" width="200"><a href="http://peterkellner.net/FilesForWebDownload/780RequestsPerSecondVerses110YouReallyNe_F121/compiled.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="compiled" border="0" alt="compiled" src="http://peterkellner.net/FilesForWebDownload/780RequestsPerSecondVerses110YouReallyNe_F121/compiled_thumb.png" width="411" height="219" /></a> </td>        <td valign="top" width="200"><a href="http://peterkellner.net/FilesForWebDownload/780RequestsPerSecondVerses110YouReallyNe_F121/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/780RequestsPerSecondVerses110YouReallyNe_F121/image_thumb.png" width="247" height="221" /></a> </td>     </tr>   </tbody></table>  <p>The code is very straight forward.&#160; Below is the code for the LINQ2SQL Not Compiled Test:</p>  <pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 90%; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  1: <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> ProcessLinqQueryNotCompiled()
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  2: {
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  3:     <span style="color: #0000ff">if</span> (meta == <span style="color: #0000ff">null</span>)
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  4:     {
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  5:         meta = <span style="color: #0000ff">new</span> DataClassesDataContext();
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  6:     }
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  7: 
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  8:     Stopwatch stopWatch = <span style="color: #0000ff">new</span> Stopwatch();
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  9:     stopWatch.Start();
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 10: 
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 11:     <span style="color: #0000ff">int</span> retCnt = 0;
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 12:     <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; iterations; i++)
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 13:     {
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 14:         <span style="color: #0000ff">const</span> <span style="color: #0000ff">int</span> companyTypeIdToFind = 1;
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 15:         var q3 = from dataCo <span style="color: #0000ff">in</span> meta.Companies
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 16:                  where (from dataCt <span style="color: #0000ff">in</span> meta.CompanyCompanyTypes
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 17:                         where dataCt.CompanyTypeId == companyTypeIdToFind
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 18:                         select dataCt.CompanyId).Contains(dataCo.Id)
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 19:                  select dataCo;
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 20: 
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 21:         var newList = q3.ToList();
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 22:         retCnt = newList.Count;
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 23:     }
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 24:     stopWatch.Stop();
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 25:     <span style="color: #0000ff">double</span> milliSecondsPerIteration = Convert.ToDouble(stopWatch.ElapsedMilliseconds)/Convert.ToDouble(iterations);
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 26:     <span style="color: #0000ff">return</span> <span style="color: #0000ff">string</span>.Format(&quot;<span style="color: #8b0000">Return Cnt: {0} LINQ Executions: {1}      Milliseconds Per Iteration: {2}</span>&quot;, retCnt, iterations,
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 27:                          String.Format(&quot;<span style="color: #8b0000">{0:0.00}</span>&quot;, milliSecondsPerIteration));
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 28: }</pre>
</pre>



<p>And, the Compiled LINQ2SQL Code:</p>

<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 90%; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  1: <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> ProcessLinqQueryCompiled()
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  2: {
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  3:     var stopWatch = <span style="color: #0000ff">new</span> Stopwatch();
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  4:     stopWatch.Start();
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  5: 
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  6:     <span style="color: #0000ff">int</span> retCnt = 0;
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  7:     <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; iterations; i++)
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  8:     {
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  9:         <span style="color: #0000ff">const</span> <span style="color: #0000ff">int</span> companyTypeIdToFind = 1;
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 10: 
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 11:         <span style="color: #0000ff">if</span> (meta == <span style="color: #0000ff">null</span>)
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 12:         {
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 13:             meta = <span style="color: #0000ff">new</span> DataClassesDataContext();
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 14:         }
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 15: 
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 16:         <span style="color: #0000ff">if</span> (_compiledQuery == <span style="color: #0000ff">null</span>)
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 17:         {
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 18:             _compiledQuery =
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 19:                 CompiledQuery.Compile((DataClassesDataContext metax, <span style="color: #0000ff">int</span> myQuery) =&gt;
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 20:                                       (from dataCo <span style="color: #0000ff">in</span> metax.Companies
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 21:                                        where (from dataCt <span style="color: #0000ff">in</span> metax.CompanyCompanyTypes
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 22:                                               where dataCt.CompanyTypeId == companyTypeIdToFind
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 23:                                               select dataCt.CompanyId).Contains(dataCo.Id)
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 24:                                        select dataCo)
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 25:                     );
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 26:         }
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 27: 
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 28:         
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 29:         var query =
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 30:             (IOrderedQueryable&lt;Company&gt;)
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 31:             _compiledQuery(meta, 1);
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 32:         var newList = query.ToList();
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 33:         retCnt = newList.Count;
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 34:     }
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 35:     stopWatch.Stop();
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 36:     <span style="color: #0000ff">double</span> milliSecondsPerIteration = Convert.ToDouble(stopWatch.ElapsedMilliseconds) / Convert.ToDouble(iterations);
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 37:     <span style="color: #0000ff">return</span> <span style="color: #0000ff">string</span>.Format(&quot;<span style="color: #8b0000">Return Cnt: {0} LINQ Executions: {1}      Milliseconds Per Iteration: {2}</span>&quot;, retCnt, iterations,
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 38:                          String.Format(&quot;<span style="color: #8b0000">{0:0.00}</span>&quot;, milliSecondsPerIteration));
</pre>

<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 39: 
</pre>

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 40: }</pre>
</pre>



<p>Bottom line, You need to compile your LINQ2SQL!</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/06/08/linq2sql-uncompiled-verses-compiled-iis-performance-aspnet/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Come See Me at VSLive in Las Vegas, June 9th (2 Sessions)</title>
		<link>http://peterkellner.net/2009/04/17/vslive-lasvegas-extjs-aspnet-high-performance/</link>
		<comments>http://peterkellner.net/2009/04/17/vslive-lasvegas-extjs-aspnet-high-performance/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 00:27:20 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Speaking]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/04/17/vslive-lasvegas-extjs-aspnet-high-performance/</guid>
		<description><![CDATA[ I’m doing two sessions at VS-Live in June.&#160; Both sessions are in the asp.net track. One is on High Speed performance in ASP.Net, and the other is on using ExtJS (a brilliantly fast rich JavaScript library).&#160; Hope to see you there!  Here are the descriptions:  VM1  Build Blazingly Fast ASP.NET Apps [...]]]></description>
			<content:encoded><![CDATA[<p> I’m doing two sessions at <a href="http://vslive.com/2009/lasvegas/">VS-Live</a> in June.&#160; Both sessions are in the asp.net track. One is on High Speed performance in ASP.Net, and the other is on using <a href="http://extjs.com/">ExtJS</a> (a brilliantly fast rich JavaScript library).&#160; Hope to see you there!</p>  <p>Here are the descriptions:</p>  <p>VM1</p>  <h3><strong>Build Blazingly Fast ASP.NET Apps with 100% Clientside UI ExtJS</strong></h3>  <p><a href="http://vslive.com/speakers.aspx#kellner">Peter Kellner </a></p>  <p><strong>Intermediate</strong></p>  <p>Need a web application that has the responsiveness and interactivity of a forms app but still looks and feels like a web? One of the best kept secrets (at least to the Microsoft community) is ExtJS. It&#8217;s a different paradigm then we are all use to, but the results are spectacular. <a href="http://extjs.com/deploy/dev/examples/samples.html">Take a look at this url</a> and you will see as well as learn how to do this yourself. The hardest part is shuttling the data back and forth. A lot of this session will be talking about how to do a real world app that does this. Once you go this way, you&#8217;ll be gone from serverside forms for almost ever.</p> <span id="more-292"></span>  <p>VM10</p>  <h3>Building High Performance ASP.NET Web Applications </h3>  <p><a href="http://vslive.com/speakers.aspx#kellner">Peter Kellner </a></p>  <p><strong>Intermediate</strong></p>  <p>Topics will include appropriate use of Cache and Session State, as well as how and when to use them. Viewstate management and methods to minimize its use will be discussed. Code to pop up a warning when a threshold is met in development will be shown. When and how to take advantage of Server Farms will be discussed, as well as trouble shooting techniques to find problems. The evils of Server Affinity, as well as a common pattern for caching database queries will be shown to be wrong. Time permitting, we will talk about using Microsoft’s Ajax.asp.net with UpdatePanel and webservices and how these affect performance and scalability.</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/04/17/vslive-lasvegas-extjs-aspnet-high-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Access Content From MasterPage in ASP.NET</title>
		<link>http://peterkellner.net/2009/03/20/aspnet-masterpage-content-search-findcontrol/</link>
		<comments>http://peterkellner.net/2009/03/20/aspnet-masterpage-content-search-findcontrol/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 16:41:28 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>
		<category><![CDATA[ASP.NET 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[GridView]]></category>
		<category><![CDATA[MasterPages]]></category>

		<guid isPermaLink="false">http://peterkellner.net/?p=272</guid>
		<description><![CDATA[So, you want to access some content from inside a page that you created from an existing master page?&#160; The most clean way to do this is to create a public property in your master page, then access that.&#160; In my case, I have a search button on a master page that I want to [...]]]></description>
			<content:encoded><![CDATA[<p>So, you want to access some content from inside a page that you created from an existing <a href="http://msdn.microsoft.com/en-us/library/4xh7yfby(VS.80).aspx">master page</a>?&#160; The most clean way to do this is to create a public property in your master page, then access that.&#160; In my case, I have a search button on a master page that I want to use from inside to pages that derive from that page.&#160; So, Here is how I declare my master page:</p>  <div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">   <div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">     <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> &lt;%@ Master Language=<span style="color: #006080">&quot;C#&quot;</span> MasterPageFile=<span style="color: #006080">&quot;~/MasterPages/MasterPage.Master&quot;</span> AutoEventWireup=<span style="color: #006080">&quot;true&quot;</span></pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span>     CodeBehind=<span style="color: #006080">&quot;ContactMasterPage.master.cs&quot;</span> Inherits=<span style="color: #006080">&quot;ThreePLogic.Web.ASPWeb.ContactPages.ContactMasterPage&quot;</span> %&gt;</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span>&#160; </pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span> &lt;asp:Content ID=<span style="color: #006080">&quot;Content5&quot;</span> ContentPlaceHolderID=<span style="color: #006080">&quot;ContentCenter&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   5:</span>         &lt;asp:TextBox ID=<span style="color: #006080">&quot;TextBoxSearchName&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span> Width=<span style="color: #006080">&quot;200px&quot;</span> CssClass=<span style="color: #006080">&quot;InputText&quot;</span>&gt;&lt;/asp:TextBox&gt;</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   6:</span>         &lt;asp:Button ID=<span style="color: #006080">&quot;ButtonSearchName&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span> CssClass=<span style="color: #006080">&quot;SearchBtn&quot;</span> /&gt;</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   7:</span>         &lt;/div&gt;</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   8:</span> &lt;/div&gt;</pre>
  </div>
</div>

<p></p>
<span id="more-272"></span>

<p>In my codebind for my masterpage, I have the following:</p>

<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
  <div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> <span style="color: #0000ff">using</span> System;</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span> <span style="color: #0000ff">using</span> System.Web.UI;</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span> <span style="color: #0000ff">using</span> System.Web.UI.WebControls;</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span> <span style="color: #0000ff">using</span> ThreePLogic.Data.ThreePLogicAccess;</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   5:</span>&#160; </pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   6:</span> <span style="color: #0000ff">namespace</span> ThreePLogic.Web.ASPWeb.ContactPages</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   7:</span> {</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   8:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">partial</span> <span style="color: #0000ff">class</span> ContactMasterPage : MasterPage</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   9:</span>     {</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  10:</span>         <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> SearchText</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  11:</span>         {</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  12:</span>             get</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  13:</span>             {</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  14:</span>                 TextBox textBoxSearch = Master.FindControl(<span style="color: #006080">&quot;ContentCenter&quot;</span>).FindControl(<span style="color: #006080">&quot;TextBoxSearchName&quot;</span>) <span style="color: #0000ff">as</span> TextBox;</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  15:</span>                 <span style="color: #0000ff">if</span> (textBoxSearch != <span style="color: #0000ff">null</span>)</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  16:</span>                 {</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  17:</span>                     <span style="color: #0000ff">return</span> textBoxSearch.Text;</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  18:</span>                 }</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  19:</span>                 <span style="color: #0000ff">else</span></pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  20:</span>                 {</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  21:</span>                     <span style="color: #0000ff">return</span> String.Empty;</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  22:</span>                 }</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  23:</span>                 </pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  24:</span>             }</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  25:</span>         }</pre>
  </div>
</div>

<p>&#160;</p>

<p>Then, in my page I derive from the masterpage I have the following.&#160; Notice that I include the masterpage type so I can have type safe access to the public property.</p>

<p>&#160;</p>

<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
  <div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> &lt;%@ Master Language=<span style="color: #006080">&quot;C#&quot;</span> MasterPageFile=<span style="color: #006080">&quot;~/ContactPages/ContactMasterPage.Master&quot;</span></pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span>     AutoEventWireup=<span style="color: #006080">&quot;true&quot;</span> CodeBehind=<span style="color: #006080">&quot;ContactCompanyMasterPage.master.cs&quot;</span> Inherits=<span style="color: #006080">&quot;ThreePLogic.Web.ASPWeb.ContactPages.ContactCompany.ContactCompanyMasterPage&quot;</span> %&gt;</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span>&#160; </pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span> &lt;%@ MasterType TypeName=<span style="color: #006080">&quot;ThreePLogic.Web.ASPWeb.ContactPages.ContactMasterPage&quot;</span> %&gt;</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   5:</span>&#160; </pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   6:</span> &lt;asp:Content ID=<span style="color: #006080">&quot;Content1&quot;</span> ContentPlaceHolderID=<span style="color: #006080">&quot;GridContent&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   7:</span>&#160; </pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   8:</span>     &lt;asp:Label ID=<span style="color: #006080">&quot;LabelSearchMirror&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span> Text=<span style="color: #006080">&quot;&quot;</span>   Visible=<span style="color: #006080">&quot;false&quot;</span> &gt;&lt;/asp:Label&gt;</pre>
  </div>
</div>

<p>&#160;</p>

<p>Then, finally, in the codebehind, this is how I access my search box.&#160; In my case, I assign it to an invisible label, then I can have server side presentation controls, like <a href="http://www.aspnet101.com/aspnet101/tutorials.aspx?id=51">GridView</a>, access it as a select parameter.</p>

<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
  <div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> <span style="color: #0000ff">using</span> System;</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span> <span style="color: #0000ff">using</span> System.Web.UI;</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span> <span style="color: #0000ff">using</span> System.Web.UI.WebControls;</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span> <span style="color: #0000ff">using</span> ThreePLogic.Common.Enums;</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   5:</span> <span style="color: #0000ff">using</span> ThreePLogic.Web.ASPWeb.Code;</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   6:</span>&#160; </pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   7:</span> <span style="color: #0000ff">namespace</span> ThreePLogic.Web.ASPWeb.ContactPages.ContactCompany</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   8:</span> {</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   9:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">partial</span> <span style="color: #0000ff">class</span> ContactCompanyMasterPage : MasterPage</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  10:</span>     {</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  11:</span>         <span style="color: #0000ff">protected</span> <span style="color: #0000ff">void</span> Page_PreRender(<span style="color: #0000ff">object</span> sender, EventArgs e)</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  12:</span>         {</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  13:</span>             GridViewCompany.PageIndex = UserService.I.GetCookieSelectedId(CookieIdType.CompanyCurrentPage);</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  14:</span>             <span style="color: #0000ff">if</span> (!String.IsNullOrEmpty(Master.SearchText))</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  15:</span>             {</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  16:</span>                 LabelSearchMirror.Text = Master.SearchText;</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  17:</span>                 GridViewCompany.DataBind();</pre>

    <pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  18:</span>             }</pre>

    <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  19:</span>         }</pre>
  </div>
</div>

<p>Good luck, and hope this helps!</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/03/20/aspnet-masterpage-content-search-findcontrol/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Arrived at Microsoft MVP Summit for Four Days of Fun and Learning</title>
		<link>http://peterkellner.net/2009/03/02/mvpsummit-2009-microsoft-day1/</link>
		<comments>http://peterkellner.net/2009/03/02/mvpsummit-2009-microsoft-day1/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 08:21:38 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>
		<category><![CDATA[Community]]></category>

		<guid isPermaLink="false">http://peterkellner.net/?p=263</guid>
		<description><![CDATA[ This is my third MVP Summit and it’s really starting out with a bang (and a little rain).&#160; I arrived today around noon to register.&#160; Immediately, I ran into at least 40 or 50 friends I have not seen since last year at this event.&#160; We then had several sessions on Microsoft products followed [...]]]></description>
			<content:encoded><![CDATA[<p> This is my third <a href="http://mvp.support.microsoft.com/gp/MVPsummit">MVP Summit</a> and it’s really starting out with a bang (and a little rain).&#160; I arrived today around noon to register.&#160; Immediately, I ran into at least 40 or 50 friends I have not seen since last year at this event.&#160; We then had several sessions on <a href="http://www.microsoft.com/en/us/default.aspx">Microsoft</a> products followed by two key notes, one from <a href="http://www.microsoft.com/presspass/exec/kaplan/default.aspx">Rich Kaplan</a>, and one from <a href="http://msmvps.com/blogs/spywaresucks/archive/2008/07/31/1642979.aspx">Toby Richards</a>, General Manager, Community and online relations.&#160; It’s really good to see Microsoft keeps investing in it’s community, even in these rough economic times.</p> <span id="more-263"></span>  <p>Below are a bunch of pictures from the opening day festivities.</p>  <table border="0" cellspacing="0" cellpadding="10" width="700"><tbody>     <tr>       <td valign="top" width="350"><a href="http://peterkellner.net/FilesForWebDownload/ArrivedatMicrosoftMVPSummitforFourDaysof_511/IMG_1253.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_1253" border="0" alt="IMG_1253" src="http://peterkellner.net/FilesForWebDownload/ArrivedatMicrosoftMVPSummitforFourDaysof_511/IMG_1253_thumb.jpg" width="244" height="184" /></a> </td>        <td valign="top" width="350"><a href="http://peterkellner.net/FilesForWebDownload/ArrivedatMicrosoftMVPSummitforFourDaysof_511/IMG_1274.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_1274" border="0" alt="IMG_1274" src="http://peterkellner.net/FilesForWebDownload/ArrivedatMicrosoftMVPSummitforFourDaysof_511/IMG_1274_thumb.jpg" width="244" height="184" /></a> </td>     </tr>      <tr>       <td valign="top" width="350"><a href="http://peterkellner.net/FilesForWebDownload/ArrivedatMicrosoftMVPSummitforFourDaysof_511/IMG_1258.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_1258" border="0" alt="IMG_1258" src="http://peterkellner.net/FilesForWebDownload/ArrivedatMicrosoftMVPSummitforFourDaysof_511/IMG_1258_thumb.jpg" width="244" height="184" /></a> </td>        <td valign="top" width="350"><a href="http://peterkellner.net/FilesForWebDownload/ArrivedatMicrosoftMVPSummitforFourDaysof_511/IMG_1263.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_1263" border="0" alt="IMG_1263" src="http://peterkellner.net/FilesForWebDownload/ArrivedatMicrosoftMVPSummitforFourDaysof_511/IMG_1263_thumb.jpg" width="244" height="184" /></a> </td>     </tr>      <tr>       <td valign="top" width="350"><a href="http://peterkellner.net/FilesForWebDownload/ArrivedatMicrosoftMVPSummitforFourDaysof_511/IMG_1264.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_1264" border="0" alt="IMG_1264" src="http://peterkellner.net/FilesForWebDownload/ArrivedatMicrosoftMVPSummitforFourDaysof_511/IMG_1264_thumb.jpg" width="244" height="184" /></a> </td>        <td valign="top" width="350"><a href="http://peterkellner.net/FilesForWebDownload/ArrivedatMicrosoftMVPSummitforFourDaysof_511/IMG_1270.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_1270" border="0" alt="IMG_1270" src="http://peterkellner.net/FilesForWebDownload/ArrivedatMicrosoftMVPSummitforFourDaysof_511/IMG_1270_thumb.jpg" width="244" height="184" /></a> </td>     </tr>   </tbody></table>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/03/02/mvpsummit-2009-microsoft-day1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 7/15 queries in 0.004 seconds using disk

Served from: peterkellner.net @ 2012-02-08 20:18:52 -->
