<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Brett Robinson's Blog</title><link>http://blogs.msdn.com/brettrobinson/default.aspx</link><description>Brett Robinson's Technical blog at Microsoft</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Windows Embedded CE6 R3 released including Silverlight for Windows Embedded</title><link>http://blogs.msdn.com/brettrobinson/archive/2009/09/23/windows-ce6-r3-released-including-silverlight-for-windows-embedded.aspx</link><pubDate>Wed, 23 Sep 2009 19:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9898541</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/9898541.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=9898541</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=9898541</wfw:comment><description>&lt;P&gt;The project I've been working on since my last blog posts has finally been released!&amp;nbsp; There is some fantastic documentation out on MSDN that can get you familiar with the new Silverlight for Windows Embedded API and how to create applications: &lt;A href="http://msdn.microsoft.com/en-us/library/ee502198.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ee502198.aspx"&gt;Silverlight for Windows Embedded&lt;/A&gt; on MSDN&lt;/P&gt;
&lt;P&gt;The first thing you might wonder is how to create an application that uses this new api.&amp;nbsp; There's an MSDN page for that: &lt;A href="http://msdn.microsoft.com/en-us/library/ee503558.aspx"&gt;http://msdn.microsoft.com/en-us/library/ee503558.aspx&lt;/A&gt;, but I thought I would start out by showing some code that I've used when creating applications.&amp;nbsp; This uses all the functions detailed on MSDN.&lt;/P&gt;
&lt;DIV style="FONT-FAMILY: Courier New; BACKGROUND: white; COLOR: black; FONT-SIZE: 10pt"&gt;&lt;PRE style="MARGIN: 0px"&gt;INT WINAPI WinMain(&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; HINSTANCE hInstance, &lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; HINSTANCE hPrevInstance, &lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPWSTR lpCmdLine, &lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; nCmdShow&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;{&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exitCode = -1;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; HRESULT&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hr = S_OK;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; XamlRuntimeManager xr;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;(xr.IsInitialized())&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;(SUCCEEDED(DoSomethingHere(lpCmdLine)))&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; exitCode = 0;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; exitCode;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;}&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;The main thing to notice here is the XamlRuntimeManager, this does all the initilization for you.&amp;nbsp; Lets take a look at what that class does.&lt;/P&gt;
&lt;DIV style="FONT-FAMILY: Courier New; BACKGROUND: white; COLOR: black; FONT-SIZE: 10pt"&gt;&lt;PRE style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: green"&gt;//this class will initialize and uninitialize XamlRuntime&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: green"&gt;//&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; XamlRuntimeManager&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;{&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt;:&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; BOOL m_IsInitialized;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt;:&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; XamlRuntimeManager()&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; m_IsInitialized = XamlRuntimeInitialize();&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~XamlRuntimeManager()&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;(m_IsInitialized)&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XamlRuntimeUninitialize();&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; BOOL IsInitialized() { &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; m_IsInitialized; }&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;};&lt;/PRE&gt;&lt;PRE style="MARGIN: 0px"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;/DIV&gt;If you want to see this code in action it is in&amp;nbsp;one of the sample applications that has shipped with R3, &lt;A href="http://msdn.microsoft.com/en-us/library/ee504084.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ee504084.aspx"&gt;XamlPerf&lt;/A&gt;.&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9898541" width="1" height="1"&gt;</description></item><item><title>Sharepoint : page level permissions</title><link>http://blogs.msdn.com/brettrobinson/archive/2009/04/24/sharepoint-page-level-permissions.aspx</link><pubDate>Sat, 25 Apr 2009 01:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9567453</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/9567453.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=9567453</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=9567453</wfw:comment><description>&lt;P&gt;Thought I would share out this quick tip on how to define page level permissions on a sharepoint wiki site.&amp;nbsp; If you go to the Pages view where you see all the pages, you can click on the drop down and click "Manage Permissions".&amp;nbsp; Then you can add/remove users and groups as needed.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9567453" width="1" height="1"&gt;</description></item><item><title>Microsoft Social Bookmarking</title><link>http://blogs.msdn.com/brettrobinson/archive/2008/05/28/microsoft-social-bookmarking.aspx</link><pubDate>Wed, 28 May 2008 07:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8556000</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/8556000.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=8556000</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=8556000</wfw:comment><description>&lt;P&gt;The team I used to work on (and my last contributions there) just launched today.&amp;nbsp; It is Microsoft's social bookmarking application.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Check it out: &lt;A href="http://social.msdn.microsoft.com/bookmarks/" mce_href="http://social.msdn.microsoft.com/bookmarks/"&gt;http://social.msdn.microsoft.com/bookmarks/&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8556000" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/bookmarking+favorites+msdn/default.aspx">bookmarking favorites msdn</category></item><item><title>Goodbye managed, hello again native</title><link>http://blogs.msdn.com/brettrobinson/archive/2008/05/15/goodbye-managed-hello-again-native.aspx</link><pubDate>Fri, 16 May 2008 01:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8509758</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/8509758.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=8509758</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=8509758</wfw:comment><description>Well, I've moved teams to the Windows Embedded team, so the content of my blog will most likely change.&amp;nbsp; Stay tuned!&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8509758" width="1" height="1"&gt;</description></item><item><title>Override javascript method in Microsoft Ajax Library</title><link>http://blogs.msdn.com/brettrobinson/archive/2008/02/28/override-javascript-method-in-microsoft-ajax-library.aspx</link><pubDate>Thu, 28 Feb 2008 23:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7937344</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/7937344.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=7937344</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=7937344</wfw:comment><description>&lt;P&gt;If you would like to override a method in javascript that uses the Microsoft Ajax Library (such as the control toolkit), you can do the following (with the&amp;nbsp;control toolkit as the base which we are overriding):&lt;/P&gt;
&lt;P mce_keep="true"&gt;Type.registerNamespace('AjaxControlToolkit');&lt;/P&gt;
&lt;P&gt;AjaxControlToolkit.YourClassName= function(element)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; AjaxControlToolkit.YourClassname.initializeBase(this,[element]);&lt;BR&gt;&amp;nbsp; //initialize any variables here&lt;BR&gt;}&lt;BR&gt;AjaxControlToolkit.YourClassName.prototype = &lt;BR&gt;{&lt;BR&gt;_setText: function(item) //this is the function we're overriding&lt;BR&gt;{ &lt;BR&gt;this._callMyNewFunction('hello there');&amp;nbsp; // we're sending an alert instead of the normal behavior&lt;BR&gt;},&lt;BR&gt;_callMyNewFunction: function(alertMessage) // my new method&lt;BR&gt;{&lt;BR&gt;alert(alertMessage);&lt;BR&gt;} &lt;/P&gt;
&lt;P&gt;AjaxControlToolkit.YourClassName.inheritsFrom(AjaxControlToolkit.AutoCompleteBehavior);&lt;/P&gt;
&lt;P&gt;AjaxControlToolkit.YourClassName.registerClass('AjaxControlToolkit.YourClassName', AjaxControlToolkit.AutoCompleteBehavior);&amp;nbsp; // second parameter is the class you're "inheriting" from&lt;/P&gt;
&lt;P&gt;This type of behavior can be applied to any class&amp;nbsp;that uses&amp;nbsp;the Microsoft Ajax Library and is very useful when you need some base behavior for a control and also&amp;nbsp;specific behavior for a particular implemenation.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7937344" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/javascript/default.aspx">javascript</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/Ajax+Library/default.aspx">Ajax Library</category></item><item><title>New release of MSDN/TechNet Search, Profile and Forums</title><link>http://blogs.msdn.com/brettrobinson/archive/2008/02/15/new-release-of-msdn-technet-search-profile-and-forums.aspx</link><pubDate>Fri, 15 Feb 2008 20:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7718986</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/7718986.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=7718986</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=7718986</wfw:comment><description>&lt;P&gt;The team I'm working on just released our latest version of MSDN/TechNet Search, Profile and Forums.&lt;/P&gt;
&lt;P&gt;For Search this is the latest release and includes the following new features (&lt;A href="http://search.msdn.microsoft.com/" mce_href="http://search.msdn.microsoft.com/"&gt;http://search.msdn.microsoft.com/&lt;/A&gt;):&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Auto-complete hit highlighting.&amp;nbsp; Now if you search for "writeline" you'll see all words that contain that phrase.&amp;nbsp; The terms&amp;nbsp;are also now&amp;nbsp;ordered by the number of times we see a certain term requested.&lt;/LI&gt;
&lt;LI&gt;Stackable refinements: after you search and we identify which topic and/or source contain your search term you can now click on multiple topic and/or source refinements and stack them to narrow your search further.&lt;/LI&gt;
&lt;LI&gt;We have increased the number of correct results for a search term with new algorithms, so hopefully you'll find your information even faster!&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Profile (&lt;A href="http://profile.msdn.microsoft.com/en-us"&gt;http://profile.msdn.microsoft.com/en-us&lt;/A&gt;&lt;A href="http://search.msdn.microsoft.com/" mce_href="http://search.msdn.microsoft.com/"&gt;&lt;/A&gt;):&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;This is a new application that will drive your profile for things like search, forums and other apps to come.&amp;nbsp; So, if you have a live ID go ahead and sign up here to&amp;nbsp;reserve&amp;nbsp;a display&amp;nbsp;name and upload an avatar!&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Forums (&lt;A href="http://forums.msdn.microsoft.com/en-us/forums" mce_href="http://forums.msdn.microsoft.com/en-us/forums"&gt;http://forums.msdn.microsoft.com/en-us/forums&lt;/A&gt;): &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Sam Jarawan created a tutorial video you can watch here that describes all the features:&amp;nbsp; &lt;A href="http://video.msn.com/video.aspx?mkt=en-us&amp;amp;vid=0f50cc69-28ac-44cd-8277-aae119d5d7cd"&gt;http://video.msn.com/video.aspx?mkt=en-us&amp;amp;vid=0f50cc69-28ac-44cd-8277-aae119d5d7cd&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7718986" width="1" height="1"&gt;</description></item><item><title>Fill server cache with a large data object and have the browser be responsive by using threads</title><link>http://blogs.msdn.com/brettrobinson/archive/2007/11/27/fill-server-cache-with-a-lot-of-data-and-still-have-the-browser-be-responsive-by-using-threads.aspx</link><pubDate>Wed, 28 Nov 2007 00:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6560118</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/6560118.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=6560118</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=6560118</wfw:comment><description>&lt;P&gt;Recently I was working on a problem, and after testing the solution I thought it would make a good blog post.&amp;nbsp; Here is what I was trying to solve:&amp;nbsp; &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Fill the cache with a large set of data (approx. 1M items).&lt;/LI&gt;
&lt;LI&gt;Have the original request to the website&amp;nbsp;fill the cache and&amp;nbsp;not block the browers responsiveness.&lt;/LI&gt;
&lt;LI&gt;Any new requests to the website should also not wait for the cache to get filled, &lt;STRONG&gt;and &lt;/STRONG&gt;also not make the request to fill the cache also.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The other thing that you should be aware of is that you should have your control be able to work without data being available that you are trying to cache.&amp;nbsp; So, lets take a look at a solution - I put the call inside of a webmethod, but you can use a normal event to accomplish the same thing.&amp;nbsp; Here is&amp;nbsp;the web page class: &lt;P&lt;!-- {\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0??;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;??\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;??\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;??\red192\green192\blue192;}??\fs20 System.Web.Services;\par System.Collections.Generic;\par System.Threading;\par System.Runtime.Remoting.Messaging;\par using\cf0 System.Web;\par ??\cf2 partial\cf0 class\cf0 _Default\cf0 : System.Web.UI.\cf10 Page\par int\cf0 _isCacheLoaded="0;\par" delegate\cf0 (\cf2 MyParameter); match calling myCacheKey;\par _requestContext;\par protected\cf0 Page_Load(\cf2 object\cf0 sender, EventArgs e)\par \par private\cf0 MyWorkerMethod(\cf2 Parameter1)\par Thread\cf0 .Sleep(120000); sleep for 2 mins (REMOVE THIS IN REAL CODE - TEST ONLY)\par myList="\cf2" &amp;gt;();\par myList.Add(\cf13 ?Brett Robinson?\cf0 );\par myList;\par [\cf10 WebMethod\cf0 ]\par DoSomething(\cf2 MyWebParameter)\par myCacheKey="\cf13" ?myCacheKey?\cf0 need save state of httpcontext because it will get dereferenced in the callback\par _requestContext="\cf10" .Current;\par )\par (\cf10 Interlocked\cf0 .Exchange(\cf2 ref\cf0 _isCacheLoaded, 1)="=" AsyncCallback AsyncCallback(CacheData); point callback="\cf2" custom delegate invoke worker myCustomDelegate="\cf2" new\cf0 (MyWorkerMethod);\par myCustomDelegate.BeginInvoke(MyWebParameter, callback, ); call method\par return\cf0 HttpContext\cf0 .Current.Cache[myCacheKey]="=" &amp;gt;;\par public\cf0 static\cf0 void\cf0 CacheData(IAsyncResult CallbackResult)\par asyncResult="CallbackResult" AsyncResult\cf0 myCustomDelegateAgain="asyncResult.AsyncDelegate" as\cf0 DelegateToCallMethod\cf0 ;\par \cf10 List\cf0 &amp;lt;\cf2 string\cf0 myValues="myCustomDelegateAgain.EndInvoke(CallbackResult);\par" (myValues !="\cf2" null\cf0 &amp;amp;&amp;amp; myValues.Count &amp;gt; 0)\par if\cf0 (!\cf2 double\cf0 .TryParse(ConfigurationManager.AppSettings[\cf13 ?SomeCacheValue?\cf0 ], out\cf0 cacheDuration))\par \{\par cacheDuration="0;\par" \cf11 default to 10\par _requestContext.Cache.Insert(myCacheKey, myValues, \cf2 null\par ??\cf0 , DateTime.Now.AddHours(cacheDuration), Cache.NoSlidingExpiration);\par ?? \}\par ??\}\par ??\par ??} --&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Web.Services;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Collections.Generic;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;3&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Threading;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Runtime.Remoting.Messaging;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Web;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;6&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;7&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;partial&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;_Default&lt;/SPAN&gt; : System.Web.UI.&lt;SPAN style="COLOR: teal"&gt;Page&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;8&lt;/SPAN&gt;&amp;nbsp;{&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; _isCacheLoaded = 0;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;delegate&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt; &lt;SPAN style="COLOR: teal"&gt;DelegateToCallMethod&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; MyParameter); &lt;SPAN style="COLOR: green"&gt;//match the calling method&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;11&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; myCacheKey;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;HttpContext&lt;/SPAN&gt; _requestContext;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;13&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;14&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Page_Load(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, EventArgs e)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;15&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;16&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;17&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;18&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;19&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt; MyWorkerMethod(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; Parameter1)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;20&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;21&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: teal"&gt;Thread&lt;/SPAN&gt;.Sleep(120000); &lt;SPAN style="COLOR: green"&gt;//sleep for 2 mins (REMOVE THIS IN REAL CODE - TEST ONLY)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;22&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: teal"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt; myList = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt;();&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;23&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; myList.Add(&lt;SPAN style="COLOR: maroon"&gt;"Brett Robinson"&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;24&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; myList;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;25&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;27&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;SPAN style="COLOR: teal"&gt;WebMethod&lt;/SPAN&gt;]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;28&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt; DoSomething(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; MyWebParameter)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;29&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;30&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; myCacheKey = &lt;SPAN style="COLOR: maroon"&gt;"myCacheKey"&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;31&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;//need to save the state of httpcontext because it will get dereferenced in the callback&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;32&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _requestContext = &lt;SPAN style="COLOR: teal"&gt;HttpContext&lt;/SPAN&gt;.Current;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;33&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (&lt;SPAN style="COLOR: teal"&gt;HttpContext&lt;/SPAN&gt;.Current.Cache[myCacheKey] == &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;34&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;35&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (&lt;SPAN style="COLOR: teal"&gt;Interlocked&lt;/SPAN&gt;.Exchange(&lt;SPAN style="COLOR: blue"&gt;ref&lt;/SPAN&gt; _isCacheLoaded, 1) == 0)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;36&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;37&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; AsyncCallback callback = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; AsyncCallback(CacheData);&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;//point to callback method&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;38&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;39&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;//custom delegate to invoke worker method&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;40&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: teal"&gt;DelegateToCallMethod&lt;/SPAN&gt; myCustomDelegate = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;DelegateToCallMethod&lt;/SPAN&gt;(MyWorkerMethod);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;41&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;42&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; myCustomDelegate.BeginInvoke(MyWebParameter, callback, &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;); &lt;SPAN style="COLOR: green"&gt;//call method&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;43&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;44&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;45&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;HttpContext&lt;/SPAN&gt;.Current.Cache[myCacheKey] &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt;;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;46&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;47&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;48&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; CacheData(IAsyncResult CallbackResult)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;49&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;50&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: teal"&gt;AsyncResult&lt;/SPAN&gt; asyncResult = CallbackResult &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;AsyncResult&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;51&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: teal"&gt;DelegateToCallMethod&lt;/SPAN&gt; myCustomDelegateAgain = asyncResult.AsyncDelegate &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;DelegateToCallMethod&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;52&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: teal"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt; myValues = myCustomDelegateAgain.EndInvoke(CallbackResult);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;53&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (myValues != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt; &amp;amp;&amp;amp; myValues.Count &amp;gt; 0)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;54&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;55&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt; cacheDuration = 0;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;56&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (!&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;.TryParse(ConfigurationManager.AppSettings[&lt;SPAN style="COLOR: maroon"&gt;"SomeCacheValue"&lt;/SPAN&gt;], &lt;SPAN style="COLOR: blue"&gt;out&lt;/SPAN&gt; cacheDuration))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;57&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;58&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; cacheDuration = 10; &lt;SPAN style="COLOR: green"&gt;//default to 10&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;59&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;60&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _requestContext.Cache.Insert(myCacheKey, myValues, &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;61&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; , DateTime.Now.AddHours(cacheDuration), Cache.NoSlidingExpiration);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;62&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#2b91af&gt;63&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_isCacheLoaded = 0;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;64&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;65&lt;/SPAN&gt;&amp;nbsp;}&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;66&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;Remember that threads are overhead, and you should only use them when they are appropriate.&amp;nbsp; Also, blocking is bad, so make sure that you never block unless completely necessary.&lt;/P&gt;
&lt;P&gt;Hope this helps!&amp;nbsp; Enjoy.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6560118" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/caching/default.aspx">caching</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/cache/default.aspx">cache</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/webmethod/default.aspx">webmethod</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/Threading/default.aspx">Threading</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/thread/default.aspx">thread</category></item><item><title>Casting with Linq</title><link>http://blogs.msdn.com/brettrobinson/archive/2007/08/31/casting-with-linq.aspx</link><pubDate>Fri, 31 Aug 2007 22:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4674851</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/4674851.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=4674851</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=4674851</wfw:comment><description>&lt;P&gt;I've been working with Linq lately and thought I would post 2 examples on casting with Linq.&amp;nbsp; Most of the ways that you get data back from linq is in&amp;nbsp;the IEnumerable&amp;lt;&amp;gt; type.&amp;nbsp; So, here's two ways to cast to&amp;nbsp;an object that&amp;nbsp;you can use:&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Linq to SQL&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Once you create your dbml file it will generate a class based on a table or your own custom class.&amp;nbsp; Once this is done, you can do the following to get your strongly typed object back:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;LinqDataContext &lt;/STRONG&gt;dataContext = new &lt;STRONG&gt;LinqDataContext&lt;/STRONG&gt;(myConnectionString);&lt;BR&gt;return dataContext.MyStoredProcedure().ToList();&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;One thing to remember - make sure that the method that Visual Studio creates for your stored procedure also returns the strongly typed class instead of the &amp;lt;T&amp;gt; (for whatever T is) that it might try to create.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;&lt;U&gt;Linq to XML&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;With Linq to Xml, just create your XDocument object by loading in the xml file.&amp;nbsp; Then you can do this (for whatever your StrongType happens to be):&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;XDocument&lt;/STRONG&gt; myXmlDoc = &lt;STRONG&gt;XDocument&lt;/STRONG&gt;.Load("somefile.xml");&lt;BR&gt;&lt;STRONG&gt;IEnumerable&lt;/STRONG&gt;&amp;lt;StrongType&amp;gt; items = from item in myXmlDoc (and whatever else your statement is to select items)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select new &lt;STRONG&gt;StrongType&lt;/STRONG&gt; { StrongTypeProperty = item.Property};&lt;BR&gt;return items.ToList();&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4674851" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/.NET+3.5/default.aspx">.NET 3.5</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/Linq/default.aspx">Linq</category></item><item><title>Model View Presenter - with base functionality</title><link>http://blogs.msdn.com/brettrobinson/archive/2007/08/07/Model-View-Presenter-_2D00_-with-base-functionality-.aspx</link><pubDate>Tue, 07 Aug 2007 16:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4049770</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/4049770.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=4049770</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=4049770</wfw:comment><description>&lt;P&gt;Lately I've been doing a lot of research and development around patterns and unit testing.&amp;nbsp; One pattern in particular, Model View Presenter (MVP), I found to be a very good pattern for doing web development.&amp;nbsp; The only thing, is that if you want to learn about the MVP, there seem to be&amp;nbsp;two options.&amp;nbsp; 1)&amp;nbsp; Completely theoretical in which you talk about the design and what its supposed to accomplish&amp;nbsp;or 2) Simple - very simple examples on how to use the MVP - that doesn't show how to expand the pattern.&amp;nbsp; So, I thought I would give it a shot to write about a more complex MVP pattern to try to handle real world scenarios.&lt;/P&gt;
&lt;P&gt;Here's some requirements for&amp;nbsp;this example:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Have a control library to handle generic/default implementations&lt;/LI&gt;
&lt;LI&gt;Have different implementations of the same control, but not have to re-write a ton of the logic.&lt;/LI&gt;
&lt;LI&gt;Server controls will write out their properties.&lt;/LI&gt;
&lt;LI&gt;Animals with different two (or N) types.&amp;nbsp; For this example I'll use Dog and Cat.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Lets get started:&lt;/P&gt;
&lt;P&gt;I start off by creating a new Control Library project that contains 3 controls:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Animal Control - this will contain the default behavior&lt;/LI&gt;
&lt;LI&gt;Dog Control - this will have dog specific behavior&lt;/LI&gt;
&lt;LI&gt;Cat Control - this will have cat specific behavior&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;I'll start with the Animal Control.&amp;nbsp; The first thing I want to do is define my interface, I do so by creating a structure that looks like this: &lt;/P&gt;
&lt;P&gt;&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs20 \cf1 namespace\cf0  MVP_Example\par ??\{\par ??    \cf1 public\cf0  \cf1 interface\cf0  \cf4 IAnimalView\par ??\cf0     \{\par ??        \cf1 string\cf0  MyNoise \{ \cf1 get\cf0 ; \cf1 set\cf0 ; \}\par ??        \cf1 string\cf0  MyHappyGesture \{ \cf1 get\cf0 ; \cf1 set\cf0 ; \}\par ??    \}\par ??\}}
--&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; MVP_Example&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;{&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;interface&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;IAnimalView&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; MyNoise { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; MyHappyGesture { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;}&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;I then create my Animal Control using the new interface and inheriting from WebControl.&amp;nbsp; This is the&amp;nbsp;main control that handles most of the details I would like to display, and the&amp;nbsp;main implementation of the view.&amp;nbsp; I added comments into the code to explain what I'm doing: &lt;/P&gt;
&lt;P&gt;&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red0\green128\blue0;\red163\green21\blue21;}??\fs20 \cf1 namespace\cf0  MVP_Example\par ??\{\par ??    \cf1 public\cf0  \cf1 class\cf0  \cf4 AnimalControl\cf0  : \cf4 WebControl\cf0 , \cf4 IAnimalView\par ??\cf0     \{\par ??        \cf1 private\cf0  \cf4 AnimalPresenter\cf0  _presenter;\par ??        \cf1 private\cf0  \cf1 string\cf0  _myNoise;\par ??        \cf1 private\cf0  \cf1 string\cf0  _myHappyGesture;\par ??\par ??        \cf1 protected\cf0  \cf1 override\cf0  \cf1 void\cf0  OnInit(\cf4 EventArgs\cf0  e)\par ??        \{\par ??            \cf1 base\cf0 .OnInit(e);\par ??\par ??            \cf5 //pass in this control (the view) to the presenter\par ??\cf0             _presenter = \cf1 new\cf0  \cf4 AnimalPresenter\cf0 (\cf1 this\cf0 ); \par ??        \}\par ??        \cf1 protected\cf0  \cf1 override\cf0  \cf1 void\cf0  Render(\cf4 HtmlTextWriter\cf0  writer)\par ??        \{\par ??\par ??            \cf5 //Here I custom render myself\par ??\cf0             writer.RenderBeginTag(\cf4 HtmlTextWriterTag\cf0 .P);\par ??            \cf5 //output my noise property as defined in the view\par ??\cf0             writer.Write(\cf1 string\cf0 .Format(\cf6 "My Noise is \{0\}"\cf0 , MyNoise)); \par ??            writer.RenderEndTag();\par ??\par ??            writer.RenderBeginTag(\cf4 HtmlTextWriterTag\cf0 .P);\par ??            \cf5 //output my gesture property as defined in the view\par ??\cf0             writer.Write(\cf1 string\cf0 .Format(\cf6 "I'm happy by \{0\}"\cf0 , MyHappyGesture)); \par ??            writer.RenderEndTag();\par ??\par ??        \}\par ??\par ??\cf1         #region\cf0  IAnimalView Members\par ??\par ??        \cf1 public\cf0  \cf1 string\cf0  MyNoise\par ??        \{\par ??            \cf1 get\par ??\cf0             \{\par ??                \cf1 return\cf0  _myNoise;\par ??            \}\par ??            \cf1 set\par ??\cf0             \{\par ??                _myNoise = \cf1 value\cf0 ;\par ??            \}\par ??        \}\par ??\par ??        \cf1 public\cf0  \cf1 string\cf0  MyHappyGesture\par ??        \{\par ??            \cf1 get\par ??\cf0             \{\par ??                \cf1 return\cf0  _myHappyGesture;\par ??            \}\par ??            \cf1 set\par ??\cf0             \{\par ??                _myHappyGesture = \cf1 value\cf0 ;\par ??            \}\par ??        \}\par ??\par ??\cf1         #endregion\par ??\cf0     \}\par ??\}}
--&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; MVP_Example&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;{&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;AnimalControl&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;WebControl&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #2b91af"&gt;IAnimalView&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;AnimalPresenter&lt;/SPAN&gt; _presenter;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; _myNoise;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; _myHappyGesture;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnInit(&lt;SPAN style="COLOR: #2b91af"&gt;EventArgs&lt;/SPAN&gt; e)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;.OnInit(e);&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;//pass in this control (the view) to the presenter&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _presenter = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;AnimalPresenter&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;); &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Render(&lt;SPAN style="COLOR: #2b91af"&gt;HtmlTextWriter&lt;/SPAN&gt; writer)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;//Here I custom render myself&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; writer.RenderBeginTag(&lt;SPAN style="COLOR: #2b91af"&gt;HtmlTextWriterTag&lt;/SPAN&gt;.P);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;//output my noise property as defined in the view&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; writer.Write(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;.Format(&lt;SPAN style="COLOR: #a31515"&gt;"My Noise is {0}"&lt;/SPAN&gt;, MyNoise)); &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; writer.RenderEndTag();&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; writer.RenderBeginTag(&lt;SPAN style="COLOR: #2b91af"&gt;HtmlTextWriterTag&lt;/SPAN&gt;.P);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;//output my gesture property as defined in the view&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; writer.Write(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;.Format(&lt;SPAN style="COLOR: #a31515"&gt;"I'm happy by {0}"&lt;/SPAN&gt;, MyHappyGesture)); &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; writer.RenderEndTag();&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #region&lt;/SPAN&gt; IAnimalView Members&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; MyNoise&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; _myNoise;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _myNoise = &lt;SPAN style="COLOR: blue"&gt;value&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; MyHappyGesture&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; _myHappyGesture;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _myHappyGesture = &lt;SPAN style="COLOR: blue"&gt;value&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;}&lt;/P&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;For my Animal Control I also have&amp;nbsp;the presenter which sets up the default values:&lt;/P&gt;
&lt;P&gt;&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red163\green21\blue21;}??\fs20 \cf1 namespace\cf0  MVP_Example\par ??\{\par ??    \cf1 public\cf0  \cf1 class\cf0  \cf4 AnimalPresenter\par ??\cf0     \{\par ??        \cf1 private\cf0  \cf4 IAnimalView\cf0  _view;\par ??\par ??        \cf1 public\cf0  AnimalPresenter(\cf4 IAnimalView\cf0  view)\par ??        \{\par ??            _view = view;\par ??            _view.MyNoise = \cf5 "Making Noise"\cf0 ;\par ??            _view.MyHappyGesture = \cf5 "Wagging My Tail"\cf0 ;\par ??        \}\par ??    \}\par ??\}}
--&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; MVP_Example&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;{&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;AnimalPresenter&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;IAnimalView&lt;/SPAN&gt; _view;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; AnimalPresenter(&lt;SPAN style="COLOR: #2b91af"&gt;IAnimalView&lt;/SPAN&gt; view)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _view = view;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _view.MyNoise = &lt;SPAN style="COLOR: #a31515"&gt;"Making Noise"&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _view.MyHappyGesture = &lt;SPAN style="COLOR: #a31515"&gt;"Wagging My Tail"&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;}&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;Next, I want to use that Animal Control, but for my dog control it barks as a noise, so I want to override that property.&amp;nbsp; I inherit from the Animal Control to get the implementation of IAnimalView that I&amp;nbsp;just coded.&amp;nbsp; The only difference is that I&amp;nbsp;have a special&amp;nbsp;DogPresenter that inherits from Animal Presenter so that I can use that functionality that I already coded.&amp;nbsp; You'll notice how empty the control is,&amp;nbsp;and that is good because you have all your logic where it should be! &lt;/P&gt;
&lt;P&gt;Here is the Dog Control:&lt;/P&gt;
&lt;P&gt;&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs20 \cf1 namespace\cf0  MVP_Example\par ??\{\par ??    \cf1 public\cf0  \cf1 class\cf0  \cf4 DogControl\cf0  : \cf4 AnimalControl\par ??\cf0     \{\par ??        \cf1 private\cf0  \cf4 DogPresenter\cf0  _presenter;\par ??\par ??        \cf1 protected\cf0  \cf1 override\cf0  \cf1 void\cf0  OnInit(\cf4 EventArgs\cf0  e)\par ??        \{\par ??            \cf1 base\cf0 .OnInit(e);\par ??            _presenter = \cf1 new\cf0  \cf4 DogPresenter\cf0 (\cf1 this\cf0 );\par ??        \}\par ??    \}\par ??\}}
--&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; MVP_Example&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;{&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DogControl&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;AnimalControl&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DogPresenter&lt;/SPAN&gt; _presenter;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnInit(&lt;SPAN style="COLOR: #2b91af"&gt;EventArgs&lt;/SPAN&gt; e)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;.OnInit(e);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _presenter = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DogPresenter&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;}&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;Here is my Dog Presenter:&lt;/P&gt;
&lt;P&gt;&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red0\green128\blue0;\red163\green21\blue21;}??\fs20 \cf1 namespace\cf0  MVP_Example\par ??\{\par ??    \cf1 public\cf0  \cf1 class\cf0  \cf4 DogPresenter\cf0  : \cf4 AnimalPresenter\par ??\cf0     \{\par ??        \cf1 private\cf0  \cf4 IAnimalView\cf0  _view;\par ??\par ??        \cf1 public\cf0  DogPresenter(\cf4 IAnimalView\cf0  view)\par ??            : \cf1 base\cf0 (view)\par ??        \{\par ??            _view = view; \cf5 // get the view from the control\par ??\par ??\cf0             \cf5 // add my own special noise, but keep the generic animal gesture\par ??\cf0             _view.MyNoise = \cf6 "Bark"\cf0 ; \par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; MVP_Example&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;{&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DogPresenter&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;AnimalPresenter&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;IAnimalView&lt;/SPAN&gt; _view;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; DogPresenter(&lt;SPAN style="COLOR: #2b91af"&gt;IAnimalView&lt;/SPAN&gt; view)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;(view)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _view = view; &lt;SPAN style="COLOR: green"&gt;// get the view from the control&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;// add my own special noise, but keep the generic animal gesture&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _view.MyNoise = &lt;SPAN style="COLOR: #a31515"&gt;"Bark"&lt;/SPAN&gt;; &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;}&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;I do the same with the&amp;nbsp;Cat&amp;nbsp;Control:&lt;/P&gt;
&lt;P&gt;&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs20 \cf1 namespace\cf0  MVP_Example\par ??\{\par ??    \cf1 public\cf0  \cf1 class\cf0  \cf4 CatControl\cf0  : \cf4 AnimalControl\par ??\cf0     \{\par ??        \cf1 private\cf0  \cf4 CatPresenter\cf0  _presenter;\par ??\par ??        \cf1 protected\cf0  \cf1 override\cf0  \cf1 void\cf0  OnInit(\cf4 EventArgs\cf0  e)\par ??        \{\par ??            \cf1 base\cf0 .OnInit(e);\par ??            _presenter = \cf1 new\cf0  \cf4 CatPresenter\cf0 (\cf1 this\cf0 );\par ??        \}\par ??    \}\par ??\}}
--&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; MVP_Example&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;{&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CatControl&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;AnimalControl&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CatPresenter&lt;/SPAN&gt; _presenter;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnInit(&lt;SPAN style="COLOR: #2b91af"&gt;EventArgs&lt;/SPAN&gt; e)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;.OnInit(e);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _presenter = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CatPresenter&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;}&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;Now with the cat presenter, it has its own noise and gesture, so I override those:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red0\green128\blue0;\red163\green21\blue21;}??\fs20 \cf1 namespace\cf0  MVP_Example\par ??\{\par ??    \cf1 public\cf0  \cf1 class\cf0  \cf4 CatPresenter\cf0  : \cf4 AnimalPresenter\par ??\cf0     \{\par ??        \cf1 private\cf0  \cf4 IAnimalView\cf0  _view;\par ??\par ??        \cf1 public\cf0  CatPresenter(\cf4 IAnimalView\cf0  view)\par ??            : \cf1 base\cf0 (view)\par ??        \{\par ??            _view = view; \cf5 // get the view from the control\par ??\cf0             _view.MyNoise = \cf6 "Meow"\cf0 ; \cf5 // add my own special noise\par ??\cf0             _view.MyHappyGesture = \cf6 "Purring"\cf0 ; \cf5 //I have my own happy gesture\par ??\cf0         \}\par ??    \}\par ??\}}
--&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; MVP_Example&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;{&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CatPresenter&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;AnimalPresenter&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;IAnimalView&lt;/SPAN&gt; _view;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; CatPresenter(&lt;SPAN style="COLOR: #2b91af"&gt;IAnimalView&lt;/SPAN&gt; view)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;(view)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _view = view; &lt;SPAN style="COLOR: green"&gt;// get the view from the control&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _view.MyNoise = &lt;SPAN style="COLOR: #a31515"&gt;"Meow"&lt;/SPAN&gt;; &lt;SPAN style="COLOR: green"&gt;// add my own special noise&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _view.MyHappyGesture = &lt;SPAN style="COLOR: #a31515"&gt;"Purring"&lt;/SPAN&gt;; &lt;SPAN style="COLOR: green"&gt;//I have my own happy gesture&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;}&lt;/P&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;Now to display these I just add a reference to the control library and add the controls to the page (here are just the lines&amp;nbsp;I added to the aspx):&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&amp;lt;%&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;@&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;Register&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;Assembly&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="MVP_Example"&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;Namespace&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="MVP_Example"&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;TagPrefix&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="animal"&lt;/FONT&gt;&lt;FONT size=2&gt; %&amp;gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;strong&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT size=2&gt;animal: &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;strong&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;animal&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;:&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;AnimalControl&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;runat&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="server"&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;/&amp;gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;strong&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT size=2&gt;dog: &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;strong&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;animal&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;:&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;DogControl&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;runat&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="server"&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;/&amp;gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;strong&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT size=2&gt;cat: &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;strong&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;animal&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;:&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;CatControl&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;runat&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;="server"&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;/&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;And the output is as follows: &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV&gt;&lt;STRONG&gt;animal: &lt;/STRONG&gt;&lt;/DIV&gt;
&lt;P&gt;My Noise is Making Noise&lt;/P&gt;
&lt;P&gt;I'm happy by Wagging My Tail&lt;/P&gt;
&lt;DIV&gt;&lt;STRONG&gt;dog: &lt;/STRONG&gt;&lt;/DIV&gt;
&lt;P&gt;My Noise is Bark&lt;/P&gt;
&lt;P&gt;I'm happy by Wagging My Tail&lt;/P&gt;
&lt;DIV&gt;&lt;STRONG&gt;cat: &lt;/STRONG&gt;&lt;/DIV&gt;
&lt;P&gt;My Noise is Meow&lt;/P&gt;
&lt;P&gt;I'm happy by Purring&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There are a few different ways to accomplish some major tasks and having your base functionality isolated and then use that base functionality in other classes.&amp;nbsp; With the MVP pattern you can pull out the logic from the user interface and keep it in the presenters.&amp;nbsp; The example from above with the inheritance&amp;nbsp;is extremely useful if you have a lot of data to get off the&amp;nbsp;http request everytime, such as the url query string items, etc.&amp;nbsp; Having&amp;nbsp;unique implementations of the&amp;nbsp;presenter for your controls is useful for having your own databinding implementations, etc.&lt;/P&gt;
&lt;P&gt;Download the code: &lt;A href="http://brob.members.winisp.net/MVP_Example.zip" mce_href="http://brob.members.winisp.net/MVP_Example.zip"&gt;http://brob.members.winisp.net/MVP_Example.zip&lt;/A&gt;&amp;nbsp;(Example was created with VS 2008 Beta 2)&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4049770" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/Model+View+Presenter/default.aspx">Model View Presenter</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/Web+Patterns/default.aspx">Web Patterns</category></item><item><title>Be a Silverlight DJ - with my Silverlight Alpha 1.1 sample</title><link>http://blogs.msdn.com/brettrobinson/archive/2007/05/23/be-a-silverlight-dj-with-my-silverlight-alpha-1-1-sample.aspx</link><pubDate>Thu, 24 May 2007 01:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2824907</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/2824907.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=2824907</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=2824907</wfw:comment><description>&lt;P&gt;I wanted to get my hands dirty with Silverlight Alpha 1.1 and so I decided to make a DJ table with two turntables where you can match two beats in different songs.&amp;nbsp; You can click the button on the bottom right of&amp;nbsp;each turntable to get the music started.&amp;nbsp; You can pause it or rewind it by clicking and dragging backwards.&amp;nbsp; There's also a fader so that you can cue up the music.&amp;nbsp; There isn't a scratch feature nor is there a fast forward feature.&amp;nbsp; &lt;/P&gt;
&lt;P align=center&gt;&lt;A class="" title="Silverlight DJ" href="http://brob.members.winisp.net/SilverlightDJ/TestPage.html" target=_blank mce_href="http://brob.members.winisp.net/SilverlightDJ/TestPage.html"&gt;&lt;IMG title="Silverlight DJ" style="WIDTH: 429px; HEIGHT: 271px" height=271 alt="Silverlight DJ" src="http://brob.members.winisp.net/SilverlightDJ.jpg" width=429 align=middle border=0 mce_src="http://brob.members.winisp.net/SilverlightDJ.jpg"&gt;&lt;/A&gt;&lt;/P&gt;I didn't write one line of javascript in this application and the entire thing is controlled by managed C# code.&amp;nbsp; Have fun!&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2824907" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>Quick tip for deploying ASP.NET Ajax to a web farm</title><link>http://blogs.msdn.com/brettrobinson/archive/2007/05/15/quick-tip-for-deploying-asp-net-ajax-to-a-web-farm.aspx</link><pubDate>Tue, 15 May 2007 19:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2652187</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/2652187.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=2652187</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=2652187</wfw:comment><description>&lt;P&gt;If you are having issues with your ASP.NET Ajax application after you deployed it&amp;nbsp;in a web farm and you notice that&amp;nbsp;your partial page refreshes are not&amp;nbsp;working, or you&amp;nbsp;have javascript null reference errors, the problem lies in a config setting.&amp;nbsp; By default the setting for the MachineKey in ASP.NET is AutoGenerate, so when the session hops from one server to another the next server can't deserialize the previous server's values.&amp;nbsp; Here's what we did to fix it.&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; Uninstall the ASP.NET Ajax installation on each server in the cluster and reinstall the same bits on each server.&amp;nbsp; This will ensure that all servers are working from the same installation.&amp;nbsp; You can skip this step if you're sure that all servers have the same installation on them and no prior installation hanging around on the machine.&amp;nbsp; Remember to do an iisreset.&amp;nbsp; If you are receiving the error "Sys is undefined", this is probably what you need to do.&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp; Generate a machine key by following this article: &lt;A href="http://msdn2.microsoft.com/en-us/library/ms998288.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms998288.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms998288.aspx&lt;/A&gt;.&amp;nbsp; There's a C# example at the bottom you can cut and paste into a console app and generate your key.&amp;nbsp; Grab that key and place it in the machine config on each of the servers.&amp;nbsp; This&amp;nbsp;will make sure&amp;nbsp;all the servers are using the same key to encode&amp;nbsp;the viewstate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this saves you some time and headaches.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2652187" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/AJAX/default.aspx">AJAX</category></item><item><title>Sandcastle Target File (using March CTP)</title><link>http://blogs.msdn.com/brettrobinson/archive/2007/05/03/sandcastle-target-file-using-march-ctp.aspx</link><pubDate>Thu, 03 May 2007 22:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2398828</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/2398828.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=2398828</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=2398828</wfw:comment><description>&lt;P&gt;I've been working on building MSDN style documents for my assemblies and wanted to automate this into my build script.&amp;nbsp; If you follow the example that comes with the Sandcastle download, it has a .bat file that executes commands for all transformations and executables.&amp;nbsp; I preferred a target file that I could add in a few properties and have the script build the files.&lt;/P&gt;
&lt;P&gt;There was one major hang up, apparently the name of the&amp;nbsp;produced documents is tied to the 'test' name.&amp;nbsp; I went so far as to modify one of the transformations (reflectionToChmProject.xsl) to look at the assembly name in the reflection.xml file and rename the files based on that.&amp;nbsp; But, it blew up at the last step of creating a chm file because it was still looking for 'test'.&amp;nbsp; So, I designed the target file so that if down the road the Sandcastle team release a version that&amp;nbsp;supports naming the documents, then you can change that property.&lt;/P&gt;
&lt;P&gt;To install, I created a folder in C:\Program Files\MSBuild\Microsoft\ called Sandcastle and dropped my target file in there.&amp;nbsp; Then I created a project file and imported the target and added the "CreateDocumentation" to the default targets.&amp;nbsp; Change your &amp;lt;CurrentDirectory&amp;gt; value to where the code lives (folder that contains .csproj) and then specify the assembly to build documentation for in the &amp;lt;Assembly&amp;gt; property.&lt;/P&gt;
&lt;P&gt;Feel free to open up the .target file and modify or change what is supported - I created it as more&amp;nbsp;of a template.&amp;nbsp; I'll eventually have the main project file change the current directory and specify multiple assemblies to build.&amp;nbsp; Then it can be useful for multiple assemblies when you build solutions.&lt;/P&gt;
&lt;P&gt;Also, this is not supported by the Sandcastle team, just something I created to build documentation with.&lt;/P&gt;
&lt;P&gt;Required Tools: HTML Help 2.0 SDK and HTML Help Workshop.&lt;/P&gt;
&lt;P&gt;Download here: &lt;A class="" href="http://brob.members.winisp.net/SandcastleTarget.zip" mce_href="http://brob.members.winisp.net/SandcastleTarget.zip"&gt;SandcatleTarget&lt;/A&gt;&amp;nbsp;(contains test.proj and Microsoft.Sandcastle.targets)&lt;/P&gt;
&lt;P&gt;&lt;SPAN lang=EN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'Arial','sans-serif'; mso-ansi-language: EN"&gt;Use of included code sample is subject to the terms specified at &lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;A href="http://www.microsoft.com/info/cpyright.htm" target=_blank mce_href="http://www.microsoft.com/info/cpyright.htm"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;FONT color=#0000cc&gt;http://www.microsoft.com/info/cpyright.htm&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2398828" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/msbuild/default.aspx">msbuild</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/Sandcastle/default.aspx">Sandcastle</category></item><item><title>MSDN and TechNet Search Updated</title><link>http://blogs.msdn.com/brettrobinson/archive/2007/04/18/msdn-and-technet-search-updated.aspx</link><pubDate>Thu, 19 Apr 2007 01:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2181896</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/2181896.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=2181896</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=2181896</wfw:comment><description>&lt;P&gt;The team I am working on just finished a re-write&amp;nbsp;of&amp;nbsp;MSDN and TechNet search.&amp;nbsp; The MSDN and TechNet&amp;nbsp;search pages now allow users to get to their answers faster than ever! Some key enhancements to the search are: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Refinements and prescoping of search terms - after your initial search you can narrow or broaden based on sub-terms&lt;/LI&gt;
&lt;LI&gt;AutoComplete for&amp;nbsp;search terms - type text in the search and see what terms are best for our search&lt;/LI&gt;
&lt;LI&gt;Globalized Search - switch your page to a particular language so its easier for you to search with.&lt;/LI&gt;
&lt;LI&gt;Results Language Switching&amp;nbsp;- want to see results for a different language?&amp;nbsp; This drop down is the spot to do it.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;One feature I use all the time now is the IE7 MSDN search provider.&amp;nbsp; Click the "Got IE7 - Get our Search" link on the MSDN search page&amp;nbsp;on the top banner&amp;nbsp;and you'll get this in your IE7:&lt;/P&gt;
&lt;P&gt;&lt;IMG title="IE7 Search" style="WIDTH: 238px; HEIGHT: 37px" height=37 alt="IE7 Search" src="http://brob.members.winisp.net/IE7_search.png" width=238 mce_src="http://brob.members.winisp.net/IE7_search.png"&gt;&amp;nbsp;- then you can search from right inside your browser and get to your answers even quicker.&lt;/P&gt;
&lt;P&gt;Try it out:&amp;nbsp; &lt;A href="http://search.msdn.microsoft.com/search/"&gt;http://search.msdn.microsoft.com/search/&lt;/A&gt; and &lt;A href="http://search.technet.microsoft.com/search/"&gt;http://search.technet.microsoft.com/search/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Now there's no other reason to search other search engines for MSDN or TechNet content!&amp;nbsp; If you don't find what you're looking for within the predefined scope of the search, you can expand your search to the internet in the refinement section:&lt;/P&gt;
&lt;P&gt;&lt;IMG title="MSDN Search Refinement" style="WIDTH: 399px; HEIGHT: 215px" height=215 alt="MSDN Search Refinement" src="http://brob.members.winisp.net/search_refinement.png" width=399 align=middle border=1 mce_src="http://brob.members.winisp.net/search_refinement.png"&gt;&lt;/P&gt;
&lt;P&gt;Also, check our Jeremiah's blog as I'm sure he will continue to post more about it: &lt;A href="http://blogs.msdn.com/msdnsearchblog/"&gt;http://blogs.msdn.com/msdnsearchblog/&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2181896" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/Search/default.aspx">Search</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/MSDN/default.aspx">MSDN</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/TechNet/default.aspx">TechNet</category></item><item><title>Componentizing Silverlight - what I consider best practices</title><link>http://blogs.msdn.com/brettrobinson/archive/2007/04/18/componentizing-silverlight-what-i-consider-best-practices.aspx</link><pubDate>Wed, 18 Apr 2007 20:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2177876</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/2177876.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=2177876</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=2177876</wfw:comment><description>&lt;P&gt;I was looking at a &lt;A class="" href="http://blogs.msdn.com/mharsh/archive/2007/04/06/gavin-gear-s-xaml-javascript-string-converter.aspx" target=_blank mce_href="http://blogs.msdn.com/mharsh/archive/2007/04/06/gavin-gear-s-xaml-javascript-string-converter.aspx"&gt;post&lt;/A&gt;&amp;nbsp;on Mike Harsh's blog about a utility that turns XAML into javascript and&amp;nbsp;I didn't entirely agree with&amp;nbsp;what this utility accomplished.&amp;nbsp; A while back I &lt;A class="" href="http://blogs.msdn.com/brettrobinson/archive/2007/01/25/wpf-e-asp-net-ajax-and-webservices-hooking-it-all-together.aspx" target=_blank mce_href="http://blogs.msdn.com/brettrobinson/archive/2007/01/25/wpf-e-asp-net-ajax-and-webservices-hooking-it-all-together.aspx"&gt;posted an entry&lt;/A&gt; about hooking in web services, Silverlight (WPF/E) and ASP.NET Ajax.&amp;nbsp;&amp;nbsp;Although I did use string concatenation in the sample, I was posting a simple example just to demonstrate how to piece those three technologies together.&amp;nbsp; After creating large solutions with multiple Silverlight components and really digging deep into the technology, I recommend a different way of building out applications.&amp;nbsp; Here's what I found to work best and a way to really manage all the pieces easily.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Lets say you are building a list in XAML and what gets populated in that list comes from some data&amp;nbsp;source (text file, web service, etc.).&amp;nbsp; Of course you could do this in javascript and create xaml in the javascript and add objects to the canvas.&amp;nbsp; But, from what I've found, this gets hard to manage and your js files become enormous.&amp;nbsp; What I did was create a XAML template and give your dynamic&amp;nbsp;values based on&amp;nbsp;format items, like so:&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;Image&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;Height&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;26&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;Width&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;32&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;Source&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;{2}&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;Canvas.Top&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;{3}&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;Canvas.Left&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;6&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;/&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Now, the file that&amp;nbsp;has the above&amp;nbsp;line of code in has a lot of different attributes that are set based on code.&amp;nbsp; So, lets see how to&amp;nbsp;hook it up.&amp;nbsp;&amp;nbsp;You have created elements that have the values being defined as a format item and you need to add those values.&amp;nbsp; How I did this was to create an object that has a property in it that represents the fragment, like this:&lt;/P&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;struct&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;Item&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;{&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; XamlFragment;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;}&lt;/P&gt;&lt;/DIV&gt;&lt;!--EndFragment--&gt;
&lt;P&gt;Then set the property to the correct data item by&amp;nbsp;streaming in the XAML template and replacing the format item with the correct value, like so:&lt;/P&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; itemTemplate = &lt;SPAN style="COLOR: teal"&gt;HttpContext&lt;/SPAN&gt;.Current.Server.MapPath(&lt;SPAN style="COLOR: maroon"&gt;"~/Xaml/Item.xaml"&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; xamlText = &lt;SPAN style="COLOR: teal"&gt;String&lt;/SPAN&gt;.Format(&lt;SPAN style="COLOR: teal"&gt;File&lt;/SPAN&gt;.ReadAllText(itemTemplate)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; , myfirstvalue&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; , textTop&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; , item.TypeIcon);&lt;/P&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-FAMILY: Arial"&gt;I built an ArrayList of Item structs&amp;nbsp;in C#&amp;nbsp;and then&amp;nbsp;have a method in javascript to call a C# web service method that returns the arraylist.&amp;nbsp; In javascript, have your function that calls the web service method point to a function that takes in the results as a parameter, like so:&lt;/DIV&gt;
&lt;DIV style="FONT-FAMILY: Arial"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="FONT-FAMILY: Arial"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;MyService.GetItems(OnSucceeded); &lt;SPAN style="COLOR: green"&gt;//call web service&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;!--EndFragment--&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-FAMILY: Arial"&gt;&lt;!--EndFragment--&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;function&lt;/SPAN&gt; OnSucceeded(result)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;{&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _results = result;&lt;/P&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Array.forEach(_results,AddXamlResultElement);&lt;/P&gt;&lt;/DIV&gt;&lt;!--EndFragment--&gt;
&lt;P style="MARGIN: 0px"&gt;}&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-FAMILY: Arial"&gt;Then use the Array.foreach method, and point it to the function to add the xaml fragment to the canvas, like so:&lt;/DIV&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;function&lt;/SPAN&gt; AddXamlResultElement(element,index)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;{&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; properCanvas.children.Add(canvas.CreateFromXaml(element.XamlFragment));&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;}&lt;/P&gt;&lt;/DIV&gt;&lt;!--EndFragment--&gt;&lt;/DIV&gt;&lt;!--EndFragment--&gt;
&lt;DIV&gt;&lt;/DIV&gt;&lt;!--EndFragment--&gt;
&lt;DIV&gt;&lt;/DIV&gt;&lt;!--EndFragment--&gt;
&lt;P&gt;Hopefully this will help you build projects and manage them that could potentially be very large.&amp;nbsp; As you can see, it cuts down on the amount of javascript you have to use to keep concatenating the strings and adding them.&amp;nbsp; Plus its a lot easier to maintain, speaking from experience.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2177876" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/XAML/default.aspx">XAML</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/WPF_2F00_E/default.aspx">WPF/E</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/Web+Services/default.aspx">Web Services</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>Get at the ASP.NET Ajax control name with the BehaviorID property</title><link>http://blogs.msdn.com/brettrobinson/archive/2007/03/01/get-at-the-asp-net-ajax-control-name-with-the-behaviorid-property.aspx</link><pubDate>Thu, 01 Mar 2007 20:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1780349</guid><dc:creator>BrettRobinson</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/brettrobinson/comments/1780349.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettrobinson/commentrss.aspx?PostID=1780349</wfw:commentRss><wfw:comment>http://blogs.msdn.com/brettrobinson/rsscomments.aspx?PostID=1780349</wfw:comment><description>&lt;P&gt;If you have ever worked with ASP.NET and binding data to a repeater control or placing content inside master pages, you're probably familiar with how ASP.NET renames the control to make it unique.&amp;nbsp; This makes web developers have many headaches as they try to get to those controls from javascript.&amp;nbsp; Here's a scenario I was recently faced with:&amp;nbsp; I had a&amp;nbsp;web control using some controls from the ASP.NET Ajax control toolkit, the TextBoxWatermarkExtender and a DropDownExtender, and a regular textbox for user input.&amp;nbsp; The web control containing all of those controls&amp;nbsp;was placed on a page that also had a master page (as you can tell there is going to be some renaming once its rendered to the browser)&amp;nbsp; The action to perform was to check if the textbox was empty and display a message to the user.&amp;nbsp; The problem was getting to that textbox, checking the text and not getting the watermark text.&amp;nbsp; The&amp;nbsp;answer to this&amp;nbsp;is in the BehaviorID property of the TextBoxWatermarkExtender.&amp;nbsp; With this id you can give the name of the control and use that in javascript to find the control.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;First set the BehaviorID in the control that you're using.&amp;nbsp; That BehaviorID you give it will be the one you use in javascript to find that control.&lt;/P&gt;
&lt;P&gt;So, the solution in javascript would be something similar to this:&lt;/P&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: green"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //this finds the object on the page or any control with a behavior id&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;var&lt;/SPAN&gt; obj = $find(&lt;SPAN style="COLOR: maroon"&gt;"watermarkextender_behaviorID_here"&lt;/SPAN&gt;);&amp;nbsp; &lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;//the get_Text method returns the text of the control, and NOT the watermark text&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;var&lt;/SPAN&gt; objectText = obj.get_Text(); &lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;(objectText == &lt;SPAN style="COLOR: maroon"&gt;''&lt;/SPAN&gt;)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;SPAN style="COLOR: maroon"&gt;"Hey User!&amp;nbsp; Enter something useful!"&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/DIV&gt;&lt;!--EndFragment--&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1780349" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/Atlas/default.aspx">Atlas</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/brettrobinson/archive/tags/AJAX/default.aspx">AJAX</category></item></channel></rss>