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

<channel>
	<title>Knowledge with Neil</title>
	<atom:link href="http://www.neilrichards.net/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.neilrichards.net/blog</link>
	<description></description>
	<lastBuildDate>Sun, 18 Jul 2010 19:40:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Fixing the SharePoint 2010 Breadcrumb</title>
		<link>http://www.neilrichards.net/blog/?p=83</link>
		<comments>http://www.neilrichards.net/blog/?p=83#comments</comments>
		<pubDate>Sun, 18 Jul 2010 16:03:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[branding]]></category>
		<category><![CDATA[sharepoint2010]]></category>
		<category><![CDATA[masterpage]]></category>

		<guid isPermaLink="false">http://www.neilrichards.net/blog/?p=83</guid>
		<description><![CDATA[In SharePoint 2010 default masterpage (v4.master) has delivered Breadcrumbs in a new, and I think confusing, way. From my perspective, this approach is difficult to use because it is hidden from the user. Once you know about it the breadcrumb is easier to find, but its nowhere near as usable as a traditional breadcrumb. Smashing Magazine [...]]]></description>
			<content:encoded><![CDATA[<p>In SharePoint 2010 default masterpage (v4.master) has delivered Breadcrumbs in a new, and I think confusing, way.</p>
<div class="wp-caption alignleft" style="width: 503px"><a href="http://muraray.wordpress.com/2009/12/12/a-fresh-move-towards-the-up-navigation-button-embedded-on-the-sharepoint-2010-ribbon/"><img title="SharePoint 2010 Breadcrumb" src="http://muraray.files.wordpress.com/2010/01/clip_image002_thumb.jpg" alt="SharePoint 2010 Breadcrumb" width="493" height="198" /></a><p class="wp-caption-text">SharePoint 2010 Breadcrumb</p></div>
<p>From my perspective, this approach is difficult to use because it is hidden from the user. Once you know about it the breadcrumb is easier to find, but its nowhere near as usable as a traditional breadcrumb.</p>
<p><a href="http://www.smashingmagazine.com/2009/03/17/breadcrumbs-in-web-design-examples-and-best-practices-2/">Smashing Magazine</a> offers a range of alternatives you can consider in implementing your own breadcrumb which are worth considering if you want to create a fully-customised master page.</p>
<p>However, want if you want a breadcrumb of the same style as SP2007?</p>
<p><a href="http://www.thesanitypoint.com/archive/2009/12/13/sharepoint-2010-everything-old-is-new-again.aspx"><img title="2007 Breadcrumb" src="http://www.thesanitypoint.com/Lists/Posts/Attachments/77/image_18_25711807.png" alt="" width="233" height="67" /></a></p>
<p>What if you want to revert the 2010 breadcrumb into the style of the 2007 breadcrumb? Well it turns out that the v3 masterpage(the 2007-style masterpage that runs on SharePoint 2010 to allow companies to avoid a visual upgrade) runs the old-school masterpage.</p>
<p>If you dive into the v3 masterpage (default.master) you can see the following snippet to in place of the breadcrumbs.</p>
<p style="padding-left: 30px;">&lt;asp:SiteMapPath SiteMapProvider=&#8221;SPContentMapProvider&#8221; id=&#8221;ContentMap&#8221;  SkipLinkText=&#8221;" RenderCurrentNodeAsLink=&#8221;true&#8221;  NodeStyle-CssClass=&#8221;ms-sitemapdirectional&#8221; runat=&#8221;server&#8221;/&gt;</p>
<p>As it turns out, if you paste that snippet into the v4 masterpage it will work perfectly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neilrichards.net/blog/?feed=rss2&amp;p=83</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install Active Directory onto a Sharepoint VM AFTER having setup Sharepoint</title>
		<link>http://www.neilrichards.net/blog/?p=73</link>
		<comments>http://www.neilrichards.net/blog/?p=73#comments</comments>
		<pubDate>Thu, 15 Oct 2009 03:49:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[stsadm]]></category>

		<guid isPermaLink="false">http://www.neilrichards.net/blog/?p=73</guid>
		<description><![CDATA[**Note: this post it limited in scope to the Single Sharepoint VM environment, anything more complicated is frankly beyond my feeble server administration skills. If you try to install AD and DNS onto a Sharepoint VM after having already installed Sharepoint you run into a range of problems. The first time I tried to fix [...]]]></description>
			<content:encoded><![CDATA[<p>**Note: this post it limited in scope to the Single Sharepoint VM environment, anything more complicated is frankly beyond my feeble server administration skills.</p>
<p>If you try to install AD and DNS onto a Sharepoint VM after having already installed Sharepoint you run into a range of problems. The first time I tried to fix the problem I fried my environment and had to revert to a snapshot.</p>
<p>First, install AD and DNS as you normally would. Here&#8217;s a link to the guide I used.</p>
<p>At this point if you try to hit your Central Administration site or any other Sharepoint site, you&#8217;ll get a <strong>Service Unavailable</strong> message on any page you hit.</p>
<p>I tried the following to bring up something, anything Sharepoint:</p>
<ul>
<li>Hitting my server via the computer name (http://phoenix:5555)</li>
<li>Hitting my server via the IP address (192.168.0.2:5555)</li>
<li>Hitting my server via localhost (http://localhost:5555)</li>
<li>Hitting my server via the fully qualified domain name (http://phoenix.kmtests.local:5555/)</li>
</ul>
<p>None of these works, and if I wasn&#8217;t getting the <strong>Service Unavailable</strong> message, I was getting one that said:</p>
<p style="padding-left: 30px;"><em>Under Construction</em></p>
<p style="padding-left: 30px;"><em>The site you are trying to view does not currently have a default page. It may be in the process of being upgraded and configured.</em></p>
<p>Looking at the server logs, you see two errors:</p>
<div id="attachment_77" class="wp-caption alignnone" style="width: 416px"><img class="size-full wp-image-77" title="ApplicationLog" src="http://www.neilrichards.net/blog/wp-content/uploads/2009/10/ApplicationLog.jpg" alt="Application Log Screenshot" width="406" height="450" /><p class="wp-caption-text">Application Log Screenshot</p></div>
<div id="attachment_76" class="wp-caption alignnone" style="width: 416px"><img class="size-full wp-image-76" title="SystemLog" src="http://www.neilrichards.net/blog/wp-content/uploads/2009/10/SystemLog.jpg" alt="System Log screenshot" width="406" height="450" /><p class="wp-caption-text">System Log screenshot</p></div>
<p>Aha! Adding a domain to the mix changes all the user accounts so that your old accounts need to be reconfigured. This is easily done by going into IIS Manager and updating the Identities of all of the app pools to reflect the new, domain enabled accounts.</p>
<p>i.e. servername\MossServiceAcct becomes domainName\MossServiceAcct</p>
<p><img class="alignnone size-full wp-image-79" title="sharedServiceProfileBefore" src="http://www.neilrichards.net/blog/wp-content/uploads/2009/10/sharedServiceProfileBefore.jpg" alt="sharedServiceProfileBefore" width="463" height="437" /></p>
<p><img class="alignnone size-full wp-image-78" title="sharedServiceProfileAfter" src="http://www.neilrichards.net/blog/wp-content/uploads/2009/10/sharedServiceProfileAfter.jpg" alt="sharedServiceProfileAfter" width="463" height="437" /></p>
<p>Having reconfigured the app pools, trying to hit the server again give you a message that says</p>
<p style="padding-left: 30px; "><span style="color: #800000;">The current identity (domainName\MossServiceAcct) does not have write access to &#8216;c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files&#8217;.</span></p>
<p>You can resolve this easily by navigating to that location and by granting write access to the folder in question (you will need to do this for each unique service account which hits the <strong>Temporary ASP.NET Files</strong> folder).</p>
<p>Central Admin will loads, but hold on cowboy/girl, you won&#8217;t be able to get to any of the pages on the <strong>Operations</strong> or <strong>Application Management</strong> tabs.</p>
<p style="padding-left: 30px; ">Some or all identity references could not be translated.   at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess)</p>
<p>Will it never end?</p>
<p>Ultimately I followed the process outlined on two specific web pages (retyping them would be silly)</p>
<ul>
<li><a href="http://blogs.msdn.com/joelo/archive/2006/08/22/712945.aspx">WSS &amp; SharePoint Server 2007 Password Change via STSADM by Joel Oleson</a></li>
<li><a href="http://support.microsoft.com/kb/934838/en-us">How to change service accounts and service account passwords in SharePoint Server 2007 and in Windows SharePoint Services 3.0</a></li>
</ul>
<p>Following Joel&#8217;s tips I got 100% of the way, but the other page a good reference anyways. I found that there were so many passwords to re-enter that I missed a couple (specifically the <strong>stsadm -o editssp</strong> command) but got there in the end.</p>
<p>Good luck, it&#8217;s a painful process, but a possible one. Just be careful and meticulous and you should be okay.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neilrichards.net/blog/?feed=rss2&amp;p=73</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to reattach a Sharepoint workflow</title>
		<link>http://www.neilrichards.net/blog/?p=70</link>
		<comments>http://www.neilrichards.net/blog/?p=70#comments</comments>
		<pubDate>Sun, 11 Oct 2009 19:18:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[sharepoint designer]]></category>

		<guid isPermaLink="false">http://www.neilrichards.net/blog/?p=70</guid>
		<description><![CDATA[Have you ever had to re-attach a Sharepoint workflow after it has been removed? It is impossible via the browser (from what I can see) and via designer it is far from obvious how to accomplish this. What you need to do is open the workflow in Sharepoint Designer, click &#8220;Finish&#8221; and the workflow will re-attach [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever had to re-attach a Sharepoint workflow after it has been removed?</p>
<p>It is impossible via the browser (from what I can see) and via designer it is far from obvious how to accomplish this. What you need to do is open the workflow in Sharepoint Designer, click &#8220;Finish&#8221; and the workflow will re-attach itself.  Not very obvious, but it works.</p>
<p>Unfortunately there is no way to associate a workflow with another list unless you open the various workflow xml files change the list guids inside.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neilrichards.net/blog/?feed=rss2&amp;p=70</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing the Sharepoint RSS Proxy issue in a VMWare environment</title>
		<link>http://www.neilrichards.net/blog/?p=67</link>
		<comments>http://www.neilrichards.net/blog/?p=67#comments</comments>
		<pubDate>Wed, 10 Jun 2009 00:22:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[webparts]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[webpart]]></category>

		<guid isPermaLink="false">http://www.neilrichards.net/blog/?p=67</guid>
		<description><![CDATA[I found this to be a total pain to figure out how to fix, but once done, the solution is actually very simple. My setup: Most people doing Sharepoint development will be doing so in a proper networked environment (setup by a proper network admin).   In which case this article is unlikely to apply to [...]]]></description>
			<content:encoded><![CDATA[<p>I found this to be a total pain to figure out how to fix, but once done, the solution is actually very simple.</p>
<p><strong>My setup:</strong></p>
<p>Most people doing Sharepoint development will be doing so in a proper networked environment (setup by a proper network admin).   In which case this article is unlikely to apply to you and <a href="http://dotnet.org.za/jpfouche/archive/2007/03/23/sharepoint-2007-rss-viewer-and-proxy-configuration.aspx">this article</a>, can probably point you in the right direction (hint: you need to set your web.config proxy settings).</p>
<p>I am running a Sharepoint development environment at my house, using VMWare, with a minimal win2k3 setup.  I&#8217;m not a server admin and I&#8217;m conscious hits to performance so the environment is very lightweight.  No Domain Controller, no Active Directory.  I&#8217;m a developer not a sysadmin.</p>
<p><strong>The problem:</strong></p>
<p>Unfortunately, Sharepoint cares not for my developing ways and when I tried adding an RSS webpart to a Sharepoint page got the following on-screen error:</p>
<p style="padding-left: 30px;"><em><strong>An unexpected error occured processing your request. Check the logs for details and correct the problem.</strong></em></p>
<p>Crapola.  First I thought dodgy rss.</p>
<p>Nope.</p>
<p>Then I thought, the IIS account doesn&#8217;t have web access.</p>
<p>Nope.</p>
<p>So then I looked at the million and one &#8220;<a href="http://www.google.co.uk/search?q=sharepoint+rss+proxy">Sharepoint rss proxy</a>&#8221; articles on Google  to no avail.  They all want you to make changes to the defaultProxy entry in your Sharepoint&#8217;s web.config.</p>
<p>Nope.</p>
<p><strong>The cause:</strong></p>
<p>For some reason, if you don&#8217;t have a proxy setup, Sharepoint throws it&#8217;s toys out the pram and won&#8217;t work.  It won&#8217;t even try to make a network call (I checked using <a href="http://www.wireshark.org/">WireShark</a>).  Even when I tried to tell the defaultProxy entry to bypass all addresses, it ignored me.</p>
<p><strong>The solution:</strong></p>
<p>Setup your own proxy.  It&#8217;s actually very simple (trust me I hate server admin stuff)</p>
<ul>
<li>disable Windows firewall (should have a firewall on your host anyways)</li>
<li>I then followed the instructions on <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;323415">support.microsoft.com</a> as best I could under the &#8220;Installing the Routing and Remote Access Service&#8221; heading.</li>
<li>Then magically my rss webparts worked</li>
</ul>
<p>Also important is to make sure you use a proper <strong>RSSViewer </strong>part instead of a <strong>RSSAggregatorWebPart </strong>(added manually).  The only difference I can see is in the configuration xml, but the latter continued to break even after my changes.</p>
<p>Hopefully this doesn&#8217;t up some insane hole in my firewall.</p>
<p>Hope that helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neilrichards.net/blog/?feed=rss2&amp;p=67</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>March 31 possible Nokia N97 release date</title>
		<link>http://www.neilrichards.net/blog/?p=62</link>
		<comments>http://www.neilrichards.net/blog/?p=62#comments</comments>
		<pubDate>Sat, 10 Jan 2009 15:56:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.neilrichards.net/blog/?p=62</guid>
		<description><![CDATA[According to play.com, the N97 is due to be released March 31 and looks to be priced at £479.99.  Now, it&#8217;s most likely that play.com have merely put down the last date of Q1 in hope that it will arrive by then, but I can live with that. It&#8217;s also good to know the full [...]]]></description>
			<content:encoded><![CDATA[<p>According to <a href="http://www.play.com/Mobiles/Mobile/4-/8267051/-/Product.html?searchstring=nokia+n97&amp;searchsource=0" target="_blank">play.com</a>, the N97 is due to be released March 31 and looks to be priced at £479.99.  Now, it&#8217;s most likely that play.com have merely put down the last date of Q1 in hope that it will arrive by then, but I can live with that.</p>
<p>It&#8217;s also good to know the full retail price is £20 less than the 8gb iPhone 3G and £120 less than the 16gb iPhone 3G.</p>
<p>I&#8217;m definitely looking forward to seeing this phone.</p>
<p>Update Jan 26: Looks like Nokia has come out and stated that March 31 <a href="http://www.pocket-lint.co.uk/news/news.phtml/20532/21556/nokia-n97-uk-release-date.phtml">IS NOT the official release date</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neilrichards.net/blog/?feed=rss2&amp;p=62</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Export a Dataview as part of a Site Template</title>
		<link>http://www.neilrichards.net/blog/?p=60</link>
		<comments>http://www.neilrichards.net/blog/?p=60#comments</comments>
		<pubDate>Tue, 21 Oct 2008 22:40:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://www.neilrichards.net/blog/?p=60</guid>
		<description><![CDATA[Out of the box, if you use a list-bound dataview as part of a Sharepoint Site Template, you&#8217;ll get a grumpy message when creating a new site &#8220;Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If [...]]]></description>
			<content:encoded><![CDATA[<p>Out of the box, if you use a list-bound dataview as part of a Sharepoint Site Template, you&#8217;ll get a grumpy message when creating a new site</p>
<p>&#8220;Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.&#8221;</p>
<p>How helpful.</p>
<p>The issue is the dataview has a hard-coded reference to the list guid on the original site.  To resolve this, simply wrap curly braces &#8220;{&#8221; and &#8220;}&#8221; around all instances of the guid.  This tells Sharepoint to refer to the newly created list when deploying the site template.</p>
<p>Granted this seems like a bug, but it works. </p>
<p>There should be 6 or 7 references to the listID in any dataview.  Just hunt through the code and you should find it fairly easily.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.neilrichards.net/blog/?feed=rss2&amp;p=60</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Music worth listening to</title>
		<link>http://www.neilrichards.net/blog/?p=58</link>
		<comments>http://www.neilrichards.net/blog/?p=58#comments</comments>
		<pubDate>Tue, 14 Oct 2008 21:50:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://www.neilrichards.net/blog/?p=58</guid>
		<description><![CDATA[Just heard a great song from the Black Tories called Ghost in the Machine which was played during the into of the most recent podcast from the Canucks Outsider.&#160; You can download it from their website&#8230;. and if you like it, buy their album.&#160; One of the best songs I&#8217;ve heard all year.&#160;]]></description>
			<content:encoded><![CDATA[<p>Just heard a great song from the <a target="_blank" href="http://www.theblacktories.com/%20">Black Tories</a> called <a target="_blank" href="http://joetory.googlepages.com/12ghostinthemachine.mp3">Ghost in the Machine</a> which was played during the into of the <a target="_blank" href="http://www.hockeynw.com/blog/davethorvald/who-owns-the-canucks-canucks-outsider-64">most recent podcast</a> from the <a target="_blank" href="http://www.hockeynw.com/">Canucks Outsider</a>.&nbsp; You can download it from their website&#8230;. and if you like it, buy their album.&nbsp; One of the best songs I&#8217;ve heard all year.&nbsp; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.neilrichards.net/blog/?feed=rss2&amp;p=58</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX-Enabled Web-Parts: solving the problem of changing Client IDs</title>
		<link>http://www.neilrichards.net/blog/?p=54</link>
		<comments>http://www.neilrichards.net/blog/?p=54#comments</comments>
		<pubDate>Wed, 17 Sep 2008 03:02:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.neilrichards.net/blog/?p=54</guid>
		<description><![CDATA[AJAX-Enabled Web-Parts: solving the problem of changing Client IDs One of the most challenging aspects of building SharePoint-enabled web parts is using JavaScript to interact with specific controls. As a consequence of how SharePoint renders controls with id’s in Sharepoint WebParts, it’s near impossible to write clean JavaScript. From a maintenance perspective I HATE using [...]]]></description>
			<content:encoded><![CDATA[<p>AJAX-Enabled Web-Parts: solving the problem of changing Client IDs</p>
<p>One of the most challenging aspects of building SharePoint-enabled web parts is using JavaScript to interact with specific controls. As a consequence of how SharePoint renders controls with id’s in Sharepoint WebParts, it’s near impossible to write clean JavaScript.</p>
<p>From a maintenance perspective I HATE using server-side code to render JavaScript. It’s inelegant and reeks of a lack of forethought. Yuck yuck yuck. It’s like sweeping dust under the rug.</p>
<p>Wherever possible, webpart-specific javascript should be held within a single .js file (stored in the 12Hive). The problem is that Sharepoint alters a control’s ID during the page rendering process.</p>
<p>So, a label with the ID “label1” might become “ctl00_label1”.  The naming process is entirely unpredictable.</p>
<p>This makes interacting with a specific DIV, INPUT or any other html element very difficult because you can’t predict the rendered IDs during development. This is especially problematic if you’re looking to host several instances of a webpart on a single page.</p>
<p>One really terrible way of dealing with this is to render the html yourself by adding literal controls ala</p>
<pre name="code" class="c#">
	LiteralControl l = new LiteralControl();
	l.text = “
blah
”;
	this.Controls.Add(l);
</pre><br />
This is a terrible approach which is severely limiting and unnecessary.</p>
<p>To tackle the problem I’ve devised the following solution which revolves around creating a Javascript class to accompany the web part:</p>
<ul>
<li>create properties to store the dynamically generated IDs of every html component to wish to interact with</li>
<li>create pointers to every html component you wish to interact with</li>
<li> create an init function. As input you pass the clientID of the webpart AND the id’s of every component you wish to interact with.</li>
</ul>
<blockquote>
<ul>
<li> this function will store the id’s using the properties</li>
<li>this function will also attach the pointers to their respective objects</li>
<li> this function should also attach any eventhandlers</li>
<li> create any supporting functions (i.e. webservice calls, webservice receivers)</li>
</ul>
</blockquote>
<p>This approach embraces the absence of reliable identification info. It is also sympathetic to having multiple copies of a webpart on the same page.</p>
<p>Here’s what the javascript might look like</p>
<p><pre name="code" class="js">
function UpdatingLabelWebPart()
{
	var me = this;	//required to reference the object at runtime
	this.clientID = null;	//ids
	this.labelID = null;
	this.buttonID = null;
	this.label = null;	//controls
	this.button = null;
	this.register = function (clientID, labelID, buttonID)
	{
		me.clientID = clientID;		//init the id
		me.labelID = labelID;
		me.buttonID = buttonID;
		me.attachToButton();
	}
	this.attachToButton = function()
	{
		//if the controls haven't loaded yet
		if (document.getElementById(me.buttonID) == null || document.getElementById(me.labelID) == null)
		{
			setTimeout(me.attachToButton, 50);
		}
		else
		{
			//register the controls
			me.label = document.getElementById(me.labelID);
			me.button = document.getElementById(me.buttonID);
			//attach any events
			button.AttachEvent("click", me.buttonClicked);
		}
	}
	this.buttonClicked = function(sender, args)
	{
		me.label.innerHTML = "Hello World";
	}
}
</pre>
<p>Then in your webpart you write a teeny tiny bit of javascript which you register as a clientscriptblock.<br />
<pre name="code" class="c#">
String myScriptBlock = String.Format(@"
					var tmp = new UpdatingLabelWebPart();
					tmp.register('{0}','{1}','{2}');
				    ", this.clientID
				    , this.label1.clientID
				    , this.button1.clientID);
Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "UpdatingLabelWebPartJS",myScriptBlock, true);
Page.ClientScript.RegisterClientScriptInclude(GetType(), GetType().ToString(), "_layouts/1033/myJS/UpdatingLabelWebPart.js");
</pre></p>
<p>This approach lets you have multiple instances of the same AJAX-enabled webpart and saves you the hassle of having to write annoying javascript (having to write me.label is hardly a chore).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neilrichards.net/blog/?feed=rss2&amp;p=54</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8216;Webservice&#8217; is undefined effor with ASP.NET AJAX</title>
		<link>http://www.neilrichards.net/blog/?p=51</link>
		<comments>http://www.neilrichards.net/blog/?p=51#comments</comments>
		<pubDate>Sat, 02 Aug 2008 14:11:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.neilrichards.net/blog/?p=51</guid>
		<description><![CDATA[I came across an annoying problem when playing with the ASP.NET Ajax extensions earlier today.  I was trying to call a script-enabled web-service but kept getting a javascript error telling me my service was undefined.  It&#8217;s been a month or so since I&#8217;ve used MS Ajax and needed a refresher. Some background: My project namespace [...]]]></description>
			<content:encoded><![CDATA[<p>I came across an annoying problem when playing with the ASP.NET Ajax extensions earlier today.  I was trying to call a script-enabled web-service but kept getting a javascript error telling me my service was undefined.  It&#8217;s been a month or so since I&#8217;ve used MS Ajax and needed a refresher.</p>
<p>Some background:</p>
<ul>
<li> My project namespace is <strong>ajaxTest</strong></li>
<li> My webservice class is <strong>helloTest</strong></li>
<li> My webservice function is <strong>helloWorld</strong></li>
</ul>
<p>I enabled the web service using the [System.Web.Script.Services.ScriptService()] attribute</p>
<p>I put the script manager code block in place and included a reference to the service.</p>
<p>&lt;asp:ScriptManager ID=&#8221;ScriptManager1&#8243; runat=&#8221;server&#8221;&gt;<br />
&lt;Services&gt;<br />
&lt;asp:ServiceReference Path=&#8221;helloTest.asmx&#8221; /&gt;<br />
&lt;/Services&gt;<br />
&lt;/asp:ScriptManager&gt;</p>
<p>I then created some javascript to call the web service</p>
<p>function testScriptService()<br />
{<br />
var tmp = helloTest.helloWorld(onResult, onTimeout, onError);<br />
}</p>
<p>It was at this point I received the &#8220;helloTest is undefined&#8221; message.</p>
<p>A quick search on google revealed two websites which helped me.  The first had the right answer (in my situation).  Strangely, the second website had a slightly different solution which seems to have helped a number of people, but I was unable to figure out why (I didn&#8217;t work for me).</p>
<p>So, the solution that worked:</p>
<p>You need to fully qualify the javascript with the namespace of your webservice.</p>
<p style="padding-left: 30px;">Namespace.Class.Function &gt;&gt; ajaxTest.helloTest.helloWorld</p>
<p>The solution which didn&#8217;t work for me but has worked for others is to use the following structure:</p>
<p style="padding-left: 30px;">Namespace.Services.Class.Function &gt;&gt; ajaxTest.Services.helloTest.helloWorld</p>
<p>No idea why the difference, but hey.</p>
<p>Credit where credit&#8217;s due, thanks to <a title="Omen's blog" href="http://omensblog.blogspot.com/2007/07/aspnet-ajax-web-service-calls-from.html" target="_blank">Omen&#8217;s blog</a> and <a title="Ryan at Solutek" href="http://solutek.org/2007/12/03/7/" target="_blank">Ryan at Solutek</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neilrichards.net/blog/?feed=rss2&amp;p=51</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Wow wow wow</title>
		<link>http://www.neilrichards.net/blog/?p=49</link>
		<comments>http://www.neilrichards.net/blog/?p=49#comments</comments>
		<pubDate>Fri, 13 Jun 2008 08:19:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://www.neilrichards.net/blog/?p=49</guid>
		<description><![CDATA[Check this out! Amazing little video (just watch the first minute or so).]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.musionmedia.co.uk/cisco_day.html" target="_blank">Check this out</a>!  Amazing little video (just watch the first minute or so).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neilrichards.net/blog/?feed=rss2&amp;p=49</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
