<?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>Peter Gerritsen&#039;s blog &#187; MOSS</title>
	<atom:link href="http://blog.petergerritsen.nl/tag/moss/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.petergerritsen.nl</link>
	<description>about .Net and SharePoint development</description>
	<lastBuildDate>Wed, 28 Jul 2010 08:28:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>InfoPath Form Template stays in “installing” state</title>
		<link>http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss</link>
		<comments>http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 10:47:57 +0000</pubDate>
		<dc:creator>Peter Gerritsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[InfoPath]]></category>
		<category><![CDATA[MOSS]]></category>

		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/</guid>
		<description><![CDATA[When I was testing to deploy a solution containing some form templates I got an error. Not very strange, because I was testing it. The main downside though was one of the templates remained in the installing state. Apparently the easiest way to remove this template is by using some custom code, in this case I just used [...]<p><a href="http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/">InfoPath Form Template stays in “installing” state</a> is a post from: <a href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>When I was testing to deploy a solution containing some form templates I got an error. Not very strange, because I was testing it.</p>
<p>The main downside though was one of the templates remained in the installing state. Apparently the easiest way to remove this template is by using some custom code, in this case I just used a console application within my dev box:</p>
<pre class="brush: csharp">

static void Main(string[] args)
{
FormsService fs = SPFarm.Local.Services.GetValue(&quot;&quot;);

foreach (FormTemplate ft in fs.FormTemplates)
{
if (ft.Name.Contains(&quot;Blackberry&quot;))
{
ft.Delete();
}
}
}
</pre>
<!-- RO Social Bookmarks BEGIN --><div class="social_bookmark"><em>Bookmark to:</em><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/" title="Add 'InfoPath Form Template stays in “installing” state' to Twitter"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/twitter.png" title="Add 'InfoPath Form Template stays in “installing” state' to Twitter" alt="Add 'InfoPath Form Template stays in “installing” state' to Twitter" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.myspace.com/Modules/PostTo/Pages/?t=InfoPath+Form+Template+stays+in+%E2%80%9Cinstalling%E2%80%9D+state&#038;c=http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/" title="Add 'InfoPath Form Template stays in “installing” state' to MySpace"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/myspace.png" title="Add 'InfoPath Form Template stays in “installing” state' to MySpace" alt="Add 'InfoPath Form Template stays in “installing” state' to MySpace" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/&#038;title=InfoPath+Form+Template+stays+in+%E2%80%9Cinstalling%E2%80%9D+state" title="Add 'InfoPath Form Template stays in “installing” state' to Del.icio.us"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/delicious.png" title="Add 'InfoPath Form Template stays in “installing” state' to Del.icio.us" alt="Add 'InfoPath Form Template stays in “installing” state' to Del.icio.us" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&#038;url=http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/&#038;title=InfoPath+Form+Template+stays+in+%E2%80%9Cinstalling%E2%80%9D+state" title="Add 'InfoPath Form Template stays in “installing” state' to digg"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/digg.png" title="Add 'InfoPath Form Template stays in “installing” state' to digg" alt="Add 'InfoPath Form Template stays in “installing” state' to digg" /></a><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/&#038;t=InfoPath+Form+Template+stays+in+%E2%80%9Cinstalling%E2%80%9D+state" title="Add 'InfoPath Form Template stays in “installing” state' to FaceBook"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/facebook.png" title="Add 'InfoPath Form Template stays in “installing” state' to FaceBook" alt="Add 'InfoPath Form Template stays in “installing” state' to FaceBook" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/" title="Add 'InfoPath Form Template stays in “installing” state' to Technorati"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/technorati.png" title="Add 'InfoPath Form Template stays in “installing” state' to Technorati" alt="Add 'InfoPath Form Template stays in “installing” state' to Technorati" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/&#038;title=InfoPath+Form+Template+stays+in+%E2%80%9Cinstalling%E2%80%9D+state" title="Add 'InfoPath Form Template stays in “installing” state' to Stumble Upon"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/stumbleupon.png" title="Add 'InfoPath Form Template stays in “installing” state' to Stumble Upon" alt="Add 'InfoPath Form Template stays in “installing” state' to Stumble Upon" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&#038;output=popup&#038;bkmk=http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/&#038;title=InfoPath+Form+Template+stays+in+%E2%80%9Cinstalling%E2%80%9D+state" title="Add 'InfoPath Form Template stays in “installing” state' to Google Bookmarks"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/google.png" title="Add 'InfoPath Form Template stays in “installing” state' to Google Bookmarks" alt="Add 'InfoPath Form Template stays in “installing” state' to Google Bookmarks" /></a></div>
<!-- RO Social Bookmarks END --><p><a  href="http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/">InfoPath Form Template stays in “installing” state</a> is a post from: <a  href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
<div class="fblike" style="height:25px; height:25px; overflow:hidden;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.petergerritsen.nl%2F2009%2F12%2F01%2Finfopath-form-template-stays-in-%25e2%2580%259cinstalling%25e2%2580%259d-state%2F&amp;layout=standard&amp;show_faces=false&amp;width=320&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allow Transparency="true" style="border:none; overflow:hidden; width:320px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://blog.petergerritsen.nl/2009/12/01/infopath-form-template-stays-in-%e2%80%9cinstalling%e2%80%9d-state/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DateTimeField vs. FieldValue in a publishing page</title>
		<link>http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss</link>
		<comments>http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 13:48:04 +0000</pubDate>
		<dc:creator>Peter Gerritsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MOSS]]></category>

		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/</guid>
		<description><![CDATA[In one of our projects we needed to show the Modified date and time value in publishing page. Not a big deal you would think. The only issue we had when using a FieldValue control is that the time that would be displayed was 1 or 2 hours later than the actual value. After I changed this [...]<p><a href="http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/">DateTimeField vs. FieldValue in a publishing page</a> is a post from: <a href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>In one of our projects we needed to show the Modified date and time value in publishing page.</p>
<p>Not a big deal you would think. The only issue we had when using a FieldValue control is that the time that would be displayed was 1 or 2 hours later than the actual value.</p>
<p>After I changed this to a DateTimeField the difference was gone.</p>
<p>The only thing you need to add is a ControlMode=”Display” attribute to prevent editors from setting their own value in edit mode.</p>
<p>The difference is in the way the value is rendered. The FieldValue control does a ToString() and HtmlEncode on the value. The DateTimeField actually converts the value to local time by using the TimeZone class.</p>
<p>It’s all in the details!</p>
<!-- RO Social Bookmarks BEGIN --><div class="social_bookmark"><em>Bookmark to:</em><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/" title="Add 'DateTimeField vs. FieldValue in a publishing page' to Twitter"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/twitter.png" title="Add 'DateTimeField vs. FieldValue in a publishing page' to Twitter" alt="Add 'DateTimeField vs. FieldValue in a publishing page' to Twitter" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.myspace.com/Modules/PostTo/Pages/?t=DateTimeField+vs.+FieldValue+in+a+publishing+page&#038;c=http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/" title="Add 'DateTimeField vs. FieldValue in a publishing page' to MySpace"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/myspace.png" title="Add 'DateTimeField vs. FieldValue in a publishing page' to MySpace" alt="Add 'DateTimeField vs. FieldValue in a publishing page' to MySpace" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/&#038;title=DateTimeField+vs.+FieldValue+in+a+publishing+page" title="Add 'DateTimeField vs. FieldValue in a publishing page' to Del.icio.us"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/delicious.png" title="Add 'DateTimeField vs. FieldValue in a publishing page' to Del.icio.us" alt="Add 'DateTimeField vs. FieldValue in a publishing page' to Del.icio.us" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&#038;url=http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/&#038;title=DateTimeField+vs.+FieldValue+in+a+publishing+page" title="Add 'DateTimeField vs. FieldValue in a publishing page' to digg"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/digg.png" title="Add 'DateTimeField vs. FieldValue in a publishing page' to digg" alt="Add 'DateTimeField vs. FieldValue in a publishing page' to digg" /></a><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/&#038;t=DateTimeField+vs.+FieldValue+in+a+publishing+page" title="Add 'DateTimeField vs. FieldValue in a publishing page' to FaceBook"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/facebook.png" title="Add 'DateTimeField vs. FieldValue in a publishing page' to FaceBook" alt="Add 'DateTimeField vs. FieldValue in a publishing page' to FaceBook" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/" title="Add 'DateTimeField vs. FieldValue in a publishing page' to Technorati"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/technorati.png" title="Add 'DateTimeField vs. FieldValue in a publishing page' to Technorati" alt="Add 'DateTimeField vs. FieldValue in a publishing page' to Technorati" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/&#038;title=DateTimeField+vs.+FieldValue+in+a+publishing+page" title="Add 'DateTimeField vs. FieldValue in a publishing page' to Stumble Upon"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/stumbleupon.png" title="Add 'DateTimeField vs. FieldValue in a publishing page' to Stumble Upon" alt="Add 'DateTimeField vs. FieldValue in a publishing page' to Stumble Upon" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&#038;output=popup&#038;bkmk=http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/&#038;title=DateTimeField+vs.+FieldValue+in+a+publishing+page" title="Add 'DateTimeField vs. FieldValue in a publishing page' to Google Bookmarks"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/google.png" title="Add 'DateTimeField vs. FieldValue in a publishing page' to Google Bookmarks" alt="Add 'DateTimeField vs. FieldValue in a publishing page' to Google Bookmarks" /></a></div>
<!-- RO Social Bookmarks END --><p><a  href="http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/">DateTimeField vs. FieldValue in a publishing page</a> is a post from: <a  href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
<div class="fblike" style="height:25px; height:25px; overflow:hidden;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.petergerritsen.nl%2F2009%2F10%2F30%2Fdatetimefield-vs-fieldvalue-in-a-publishing-page%2F&amp;layout=standard&amp;show_faces=false&amp;width=320&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allow Transparency="true" style="border:none; overflow:hidden; width:320px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://blog.petergerritsen.nl/2009/10/30/datetimefield-vs-fieldvalue-in-a-publishing-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying calendar items in an ItemStyle</title>
		<link>http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss</link>
		<comments>http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 14:05:21 +0000</pubDate>
		<dc:creator>Peter Gerritsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/</guid>
		<description><![CDATA[We frequently get the question to display the next x upcoming events in a rollup webpart. A content query web part is very suitable for this, but you will needa custom ItemStyle. Below you will find the xsl to display events in the following format: The custom itemstyle checks for the difference between all day [...]<p><a href="http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/">Displaying calendar items in an ItemStyle</a> is a post from: <a href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>
We frequently get the question to display the next <em>x</em> upcoming events in a rollup webpart. A content query web part is very suitable for this, but you will needa custom ItemStyle. Below you will find the xsl to display events in the following<br />
format:
</p>
<p>
<a  href="http://blog.petergerritsen.nl/wp-content/uploads/snipping16.png" class="thickbox no_icon" rel="gallery-547"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="http://blog.petergerritsen.nl/wp-content/uploads/snipping17.png" width=315 height=73></a>
</p>
<p>
The custom itemstyle checks for the difference between all day events, events that span multiple days and checks for start and end times.
</p>
<p>
To use this itemstyle you will need to add EventDate and EndDate to the CommonViewFields and reference the ddwrt namespace in the top of your xsl:
</p>
<pre class="brush: xslt">xmlns:ddwrt=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/runtime&quot;</pre>
<p>
And finally here’s the itemstyle:
</p>
<pre class="brush: xslt">
&lt;xsl:template name=&quot;CalendarEvent&quot; match=&quot;Row[@Style=&#039;CalendarEvent&#039;]&quot; mode=&quot;itemstyle&quot;&gt;
         &lt;xsl:variable name=&quot;SafeImageUrl&quot;&gt;
            &lt;xsl:call-template name=&quot;OuterTemplate.GetSafeStaticUrl&quot;&gt;
                &lt;xsl:with-param name=&quot;UrlColumnName&quot; select=&quot;&#039;ImageUrl&#039;&quot;/&gt;
            &lt;/xsl:call-template&gt;
        &lt;/xsl:variable&gt;
        &lt;xsl:variable name=&quot;SafeLinkUrl&quot;&gt;
            &lt;xsl:call-template name=&quot;OuterTemplate.GetSafeLink&quot;&gt;
                &lt;xsl:with-param name=&quot;UrlColumnName&quot; select=&quot;&#039;LinkUrl&#039;&quot;/&gt;
            &lt;/xsl:call-template&gt;
        &lt;/xsl:variable&gt;
        &lt;xsl:variable name=&quot;DisplayTitle&quot;&gt;
            &lt;xsl:call-template name=&quot;OuterTemplate.GetTitle&quot;&gt;
                &lt;xsl:with-param name=&quot;Title&quot; select=&quot;@Title&quot;/&gt;
                &lt;xsl:with-param name=&quot;UrlColumnName&quot; select=&quot;&#039;LinkUrl&#039;&quot;/&gt;
            &lt;/xsl:call-template&gt;
       &lt;/xsl:variable&gt;
          &lt;xsl:variable name=&quot;LinkTarget&quot;&gt;
             &lt;xsl:if test=&quot;@OpenInNewWindow = &#039;True&#039;&quot; &gt;_blank&lt;/xsl:if&gt;
       &lt;/xsl:variable&gt;
       &lt;xsl:variable name=&quot;MultiDayEvent&quot;&gt;
           &lt;xsl:choose&gt;
               &lt;xsl:when test=&quot;starts-with(@EndDate,substring(@EventDate, 0, 11))&quot;&gt;
                   0
               &lt;/xsl:when&gt;
               &lt;xsl:otherwise&gt;
                   1
               &lt;/xsl:otherwise&gt;
           &lt;/xsl:choose&gt;
       &lt;/xsl:variable&gt;
       &lt;xsl:variable name=&quot;StartTimeIsEndTime&quot;&gt;
           &lt;xsl:choose&gt;
               &lt;xsl:when test=&quot;contains(@EndDate,substring(@EventDate, 11, 9))&quot;&gt;
                   1
               &lt;/xsl:when&gt;
               &lt;xsl:otherwise&gt;
                   0
               &lt;/xsl:otherwise&gt;
           &lt;/xsl:choose&gt;
       &lt;/xsl:variable&gt;
       &lt;xsl:variable name=&quot;DisplayDate&quot;&gt;
           &lt;xsl:choose&gt;
               &lt;xsl:when test=&quot;$MultiDayEvent = 0&quot;&gt;
                   &lt;xsl:choose&gt;
                       &lt;xsl:when test=&quot;@fAllDayEvent = 0&quot;&gt;
                        &lt;xsl:choose&gt;
                               &lt;xsl:when test=&quot;$StartTimeIsEndTime = 1&quot;&gt;
                                   &lt;xsl:value-of select=&quot;ddwrt:FormatDateTime(string(@EventDate) ,1043 ,&#039;dd-MM-yyyy H:mm&#039;)&quot; /&gt;
                               &lt;/xsl:when&gt;
                               &lt;xsl:otherwise&gt;
                                   &lt;xsl:value-of select=&quot;ddwrt:FormatDateTime(string(@EventDate) ,1043 ,&#039;dd-MM-yyyy H:mm&#039;)&quot; /&gt; - &lt;xsl:value-of select=&quot;ddwrt:FormatDateTime(string(@EndDate) ,1043 ,&#039;H:mm&#039;)&quot; /&gt;
                               &lt;/xsl:otherwise&gt;
                           &lt;/xsl:choose&gt;
                       &lt;/xsl:when&gt;
                       &lt;xsl:otherwise&gt;
                        &lt;xsl:value-of select=&quot;ddwrt:FormatDateTime(string(@EventDate) ,1043 ,&#039;dd-MM-yyyy&#039;)&quot; /&gt;
                    &lt;/xsl:otherwise&gt;
                   &lt;/xsl:choose&gt;
               &lt;/xsl:when&gt;
               &lt;xsl:otherwise&gt;
                   &lt;xsl:choose&gt;
                       &lt;xsl:when test=&quot;@fAllDayEvent = 0&quot;&gt;
                           &lt;xsl:value-of select=&quot;ddwrt:FormatDateTime(string(@EventDate) ,1043 ,&#039;dd-MM-yyyy H:mm&#039;)&quot; /&gt; - &lt;xsl:value-of select=&quot;ddwrt:FormatDateTime(string(@EndDate) ,1043 ,&#039;dd-MM-yyyy H:mm&#039;)&quot; /&gt;
                       &lt;/xsl:when&gt;
                       &lt;xsl:otherwise&gt;
                           &lt;xsl:value-of select=&quot;ddwrt:FormatDateTime(string(@EventDate) ,1043 ,&#039;dd-MM-yyyy&#039;)&quot; /&gt; - &lt;xsl:value-of select=&quot;ddwrt:FormatDateTime(string(@EndDate) ,1043 ,&#039;dd-MM-yyyy&#039;)&quot; /&gt;
                       &lt;/xsl:otherwise&gt;
                   &lt;/xsl:choose&gt;
               &lt;/xsl:otherwise&gt;
           &lt;/xsl:choose&gt;
       &lt;/xsl:variable&gt;
       &lt;a href=&quot;{$SafeLinkUrl}&quot; target=&quot;{$LinkTarget}&quot; title=&quot;{@LinkToolTip}&quot;&gt;
            &lt;xsl:value-of select=&quot;$DisplayTitle&quot;/&gt;
        &lt;/a&gt;
        &lt;xsl:text&gt; - &lt;/xsl:text&gt;&lt;xsl:value-of select=&quot;$DisplayDate&quot;/&gt;&lt;br/&gt;
    &lt;/xsl:template&gt;
</pre>
<!-- RO Social Bookmarks BEGIN --><div class="social_bookmark"><em>Bookmark to:</em><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/" title="Add 'Displaying calendar items in an ItemStyle' to Twitter"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/twitter.png" title="Add 'Displaying calendar items in an ItemStyle' to Twitter" alt="Add 'Displaying calendar items in an ItemStyle' to Twitter" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.myspace.com/Modules/PostTo/Pages/?t=Displaying+calendar+items+in+an+ItemStyle&#038;c=http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/" title="Add 'Displaying calendar items in an ItemStyle' to MySpace"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/myspace.png" title="Add 'Displaying calendar items in an ItemStyle' to MySpace" alt="Add 'Displaying calendar items in an ItemStyle' to MySpace" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/&#038;title=Displaying+calendar+items+in+an+ItemStyle" title="Add 'Displaying calendar items in an ItemStyle' to Del.icio.us"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/delicious.png" title="Add 'Displaying calendar items in an ItemStyle' to Del.icio.us" alt="Add 'Displaying calendar items in an ItemStyle' to Del.icio.us" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&#038;url=http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/&#038;title=Displaying+calendar+items+in+an+ItemStyle" title="Add 'Displaying calendar items in an ItemStyle' to digg"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/digg.png" title="Add 'Displaying calendar items in an ItemStyle' to digg" alt="Add 'Displaying calendar items in an ItemStyle' to digg" /></a><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/&#038;t=Displaying+calendar+items+in+an+ItemStyle" title="Add 'Displaying calendar items in an ItemStyle' to FaceBook"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/facebook.png" title="Add 'Displaying calendar items in an ItemStyle' to FaceBook" alt="Add 'Displaying calendar items in an ItemStyle' to FaceBook" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/" title="Add 'Displaying calendar items in an ItemStyle' to Technorati"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/technorati.png" title="Add 'Displaying calendar items in an ItemStyle' to Technorati" alt="Add 'Displaying calendar items in an ItemStyle' to Technorati" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/&#038;title=Displaying+calendar+items+in+an+ItemStyle" title="Add 'Displaying calendar items in an ItemStyle' to Stumble Upon"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/stumbleupon.png" title="Add 'Displaying calendar items in an ItemStyle' to Stumble Upon" alt="Add 'Displaying calendar items in an ItemStyle' to Stumble Upon" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&#038;output=popup&#038;bkmk=http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/&#038;title=Displaying+calendar+items+in+an+ItemStyle" title="Add 'Displaying calendar items in an ItemStyle' to Google Bookmarks"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/google.png" title="Add 'Displaying calendar items in an ItemStyle' to Google Bookmarks" alt="Add 'Displaying calendar items in an ItemStyle' to Google Bookmarks" /></a></div>
<!-- RO Social Bookmarks END --><p><a  href="http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/">Displaying calendar items in an ItemStyle</a> is a post from: <a  href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
<div class="fblike" style="height:25px; height:25px; overflow:hidden;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.petergerritsen.nl%2F2009%2F07%2F29%2Fdisplaying-calendar-items-in-an-itemstyle%2F&amp;layout=standard&amp;show_faces=false&amp;width=320&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allow Transparency="true" style="border:none; overflow:hidden; width:320px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://blog.petergerritsen.nl/2009/07/29/displaying-calendar-items-in-an-itemstyle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enhancements to Office client integration with Forms Based Authentication on SharePoint</title>
		<link>http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss</link>
		<comments>http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/#comments</comments>
		<pubDate>Sat, 16 May 2009 19:20:10 +0000</pubDate>
		<dc:creator>Peter Gerritsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Forms Based Authentication]]></category>
		<category><![CDATA[MOSS]]></category>

		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/</guid>
		<description><![CDATA[Recently Steve Peschka of the SharePoint Team blogged about improvements in Office client integration when you’re using Forms Based Authentication. After installing an update for the Office Clients you are now prompted with a login box when you edit an Office document on a SharePoint site that uses FBA: When you have a customized login page this [...]<p><a href="http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/">Enhancements to Office client integration with Forms Based Authentication on SharePoint</a> is a post from: <a href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Recently Steve Peschka of the SharePoint Team blogged about improvements in Office client integration when you’re using Forms Based Authentication.</p>
<p>After installing an update for the Office Clients you are now prompted with a login box when you edit an Office document on a SharePoint site that uses FBA:</p>
<p><a  href="http://blog.petergerritsen.nl/wp-content/uploads/snipping18.png" class="thickbox no_icon" rel="gallery-552" title="image"><img style="display: inline; border: 0px;" title="image" src="http://blog.petergerritsen.nl/wp-content/uploads/snipping19.png" border="0" alt="image" /></a></p>
<p>When you have a customized login page this will be shown instead, so users won’t be (or will be less) confused when they get a login form with your company’s branding applied.</p>
<p>Read more about it here:<br />
<a  title="http://blogs.msdn.com/sharepoint/archive/2009/05/13/update-on-sharepoint-forms-based-authentication-fba-and-office-client.aspx" href="http://blogs.msdn.com/sharepoint/archive/2009/05/13/update-on-sharepoint-forms-based-authentication-fba-and-office-client.aspx">http://blogs.msdn.com/sharepoint/archive/2009/05/13/update-on-sharepoint-forms-based-authentication-fba-and-office-client.aspx</a></p>
<!-- RO Social Bookmarks BEGIN --><div class="social_bookmark"><em>Bookmark to:</em><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Twitter"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/twitter.png" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Twitter" alt="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Twitter" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.myspace.com/Modules/PostTo/Pages/?t=Enhancements+to+Office+client+integration+with+Forms+Based+Authentication+on+SharePoint&#038;c=http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to MySpace"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/myspace.png" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to MySpace" alt="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to MySpace" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/&#038;title=Enhancements+to+Office+client+integration+with+Forms+Based+Authentication+on+SharePoint" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Del.icio.us"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/delicious.png" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Del.icio.us" alt="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Del.icio.us" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&#038;url=http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/&#038;title=Enhancements+to+Office+client+integration+with+Forms+Based+Authentication+on+SharePoint" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to digg"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/digg.png" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to digg" alt="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to digg" /></a><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/&#038;t=Enhancements+to+Office+client+integration+with+Forms+Based+Authentication+on+SharePoint" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to FaceBook"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/facebook.png" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to FaceBook" alt="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to FaceBook" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Technorati"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/technorati.png" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Technorati" alt="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Technorati" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/&#038;title=Enhancements+to+Office+client+integration+with+Forms+Based+Authentication+on+SharePoint" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Stumble Upon"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/stumbleupon.png" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Stumble Upon" alt="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Stumble Upon" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&#038;output=popup&#038;bkmk=http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/&#038;title=Enhancements+to+Office+client+integration+with+Forms+Based+Authentication+on+SharePoint" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Google Bookmarks"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/google.png" title="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Google Bookmarks" alt="Add 'Enhancements to Office client integration with Forms Based Authentication on SharePoint' to Google Bookmarks" /></a></div>
<!-- RO Social Bookmarks END --><p><a  href="http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/">Enhancements to Office client integration with Forms Based Authentication on SharePoint</a> is a post from: <a  href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
<div class="fblike" style="height:25px; height:25px; overflow:hidden;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.petergerritsen.nl%2F2009%2F05%2F16%2Fenhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint%2F&amp;layout=standard&amp;show_faces=false&amp;width=320&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allow Transparency="true" style="border:none; overflow:hidden; width:320px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://blog.petergerritsen.nl/2009/05/16/enhancements-to-office-client-integration-with-forms-based-authentication-on-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful SharePoint classes</title>
		<link>http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss</link>
		<comments>http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 14:09:18 +0000</pubDate>
		<dc:creator>Peter Gerritsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MOSS]]></category>

		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/</guid>
		<description><![CDATA[I just found out that the object model includes some very useful classes to speed up your coding efforts. SPUtilty Contains methods for redirecting users to the error page, access denied page or a custom url. You can get Full name and email adres of a user by passing in the logginname, send an email from the web [...]<p><a href="http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/">Useful SharePoint classes</a> is a post from: <a href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I just found out that the object model includes some very useful classes to speed up your coding efforts.</p>
<p><strong>SPUtilty</strong></p>
<p>Contains methods for redirecting users to the error page, access denied page or a custom url. You can get Full name and email adres of a user by passing in the logginname, send an email from the web context or determine if an lcid is an East-Asian lcid.</p>
<p>More information here:<br />
<a  title="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.aspx" href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.aspx">http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.aspx</a></p>
<p><strong>SPBuiltinFieldId</strong></p>
<p>Contains variables for all the Guids of the built in fields. No need to worry about the difference between dutch and english MOSS sites.</p>
<p><strong>SPBuiltInContentTypeId</strong></p>
<p>Contains variables for all the Guids of the built-in contenttypes.</p>
<p><strong>SPDiffUtilty</strong></p>
<p>Shows the differences between two strings in Html format. So comparing “This is an initial string” with “This” returns the following: “<strong>This <span style="text-decoration: line-through;">is an initial string</span></strong>“</p>
<p><strong>SPContentTypeId (structure)</strong></p>
<p>Provides methods to determine the relationships between two contenttypes.</p>
<p><strong>SPContentTypeUsage</strong></p>
<p>Allows you to determine where contenttypes are used within the sitecollection. Here’s a useful post that shows code to audit the contenttype hierarchy:<br />
<a  title="http://soerennielsen.wordpress.com/2008/03/06/audit-your-content-type-hierarchy/" href="http://soerennielsen.wordpress.com/2008/03/06/audit-your-content-type-hierarchy/">http://soerennielsen.wordpress.com/2008/03/06/audit-your-content-type-hierarchy/</a></p>
<p><strong>SPChangeQuery</strong></p>
<p>Allows you to query your sitecollection for objects that have changed. This way you can audit changes in access rights for instance.</p>
<!-- RO Social Bookmarks BEGIN --><div class="social_bookmark"><em>Bookmark to:</em><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/" title="Add 'Useful SharePoint classes' to Twitter"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/twitter.png" title="Add 'Useful SharePoint classes' to Twitter" alt="Add 'Useful SharePoint classes' to Twitter" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.myspace.com/Modules/PostTo/Pages/?t=Useful+SharePoint+classes&#038;c=http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/" title="Add 'Useful SharePoint classes' to MySpace"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/myspace.png" title="Add 'Useful SharePoint classes' to MySpace" alt="Add 'Useful SharePoint classes' to MySpace" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/&#038;title=Useful+SharePoint+classes" title="Add 'Useful SharePoint classes' to Del.icio.us"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/delicious.png" title="Add 'Useful SharePoint classes' to Del.icio.us" alt="Add 'Useful SharePoint classes' to Del.icio.us" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&#038;url=http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/&#038;title=Useful+SharePoint+classes" title="Add 'Useful SharePoint classes' to digg"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/digg.png" title="Add 'Useful SharePoint classes' to digg" alt="Add 'Useful SharePoint classes' to digg" /></a><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/&#038;t=Useful+SharePoint+classes" title="Add 'Useful SharePoint classes' to FaceBook"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/facebook.png" title="Add 'Useful SharePoint classes' to FaceBook" alt="Add 'Useful SharePoint classes' to FaceBook" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/" title="Add 'Useful SharePoint classes' to Technorati"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/technorati.png" title="Add 'Useful SharePoint classes' to Technorati" alt="Add 'Useful SharePoint classes' to Technorati" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/&#038;title=Useful+SharePoint+classes" title="Add 'Useful SharePoint classes' to Stumble Upon"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/stumbleupon.png" title="Add 'Useful SharePoint classes' to Stumble Upon" alt="Add 'Useful SharePoint classes' to Stumble Upon" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&#038;output=popup&#038;bkmk=http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/&#038;title=Useful+SharePoint+classes" title="Add 'Useful SharePoint classes' to Google Bookmarks"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/google.png" title="Add 'Useful SharePoint classes' to Google Bookmarks" alt="Add 'Useful SharePoint classes' to Google Bookmarks" /></a></div>
<!-- RO Social Bookmarks END --><p><a  href="http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/">Useful SharePoint classes</a> is a post from: <a  href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
<div class="fblike" style="height:25px; height:25px; overflow:hidden;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.petergerritsen.nl%2F2009%2F04%2F03%2Fuseful-sharepoint-classes%2F&amp;layout=standard&amp;show_faces=false&amp;width=320&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allow Transparency="true" style="border:none; overflow:hidden; width:320px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://blog.petergerritsen.nl/2009/04/03/useful-sharepoint-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building an AJAX web part with jQuery (Part 3)</title>
		<link>http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss</link>
		<comments>http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 13:36:35 +0000</pubDate>
		<dc:creator>Peter Gerritsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MOSS]]></category>

		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/</guid>
		<description><![CDATA[In part 1 of this series I explained a bit about the context and goal of creating an AJAX web part without using ASP.Net AJAX. I also showed the steps necessary for creating services that return data in the JSON format. In part 2 I showed you how to call these services from JavaScript and render the HTML for the [...]<p><a href="http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/">Building an AJAX web part with jQuery (Part 3)</a> is a post from: <a href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>In <a  href="http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/">part 1</a> of this series I explained a bit about the context and goal of creating an AJAX web part without using ASP.Net AJAX. I also showed the steps necessary for creating services that return data in the JSON format. In <a  href="http://blogs.tamtam.nl/peterg/2009/03/31/BuildingAnAJAXWebPartWithJQueryPart2.aspx" target="_blank">part 2</a> I showed you how to call these services from JavaScript and render the HTML for the data. In this last part I’ll show you how to use the jQuery UI and validation plugins.</p>
<h4>jQuery UI</h4>
<p>The <a  href="http://jqueryui.com/home" target="_blank">jQuery UI</a> plugin provides some useful widgets and effects to use in your jQuery based scripts. It also offers an advanced theme framework, so you don’t have to write all the css by yourself. You can use one of the included theme’s or roll your own with the <a  href="http://jqueryui.com/themeroller/" target="_blank">ThemeRoller</a>.</p>
<p>I’ve decided to use the UI plugin for tree things in my web part:</p>
<ul>
<li> Datepicker widget to specify the orderdate</li>
<li> Dialog widget to show confirmation dialogs, edit forms and validation messages</li>
<li> Highlighting effect to focus the users attention to changing data, such as the shoppingcart</li>
</ul>
<p><strong>Datepicker</strong></p>
<p>The datepicker enhances a standard text input box with a datapicker that slides out when the textbox receives focus. It contains different options for specifying the allowed dates, year/month selection and more. When it’s shown it will look like this:</p>
<p><a  href="http://blog.petergerritsen.nl/wp-content/uploads/snipping20.png" class="thickbox no_icon" rel="gallery-558" title="image"><img style="border-width: 0px; display: inline;" title="image" src="http://blog.petergerritsen.nl/wp-content/uploads/snipping21.png" border="0" alt="image" /></a></p>
<p>Linking it to your input box is very simple. I use the following code:</p>
<pre class="brush: javascript">
$(&quot;#bpvorderdate&quot;).datepicker({
showOn: &#039;button&#039;,
minDate: +1, dateFormat: &#039;dd/mm/yy&#039;,
buttonImage: &#039;/_layouts/images/calendar.gif&#039;,
buttonImageOnly: true
});
</pre>
<p>In this case, the user has to press a button (in this case an imagebutton) to open the datepicker.</p>
<p><strong>Dialogs</strong></p>
<p>Dialogs are a very useful way to give feedback to the user or asking for confirmation. In my web part I want to show a confirmation dialog when a user presses the delete icon next to a product in the shoppingcart or the “clear shoppingcart” button. The user will be presented with the following dialog:</p>
<p><a  href="http://blog.petergerritsen.nl/wp-content/uploads/snipping22.png" class="thickbox no_icon" rel="gallery-558" title="image"><img style="border-width: 0px; display: inline;" title="image" src="http://blog.petergerritsen.nl/wp-content/uploads/snipping23.png" border="0" alt="image" /></a></p>
<p>Showing this is very easy. First we create a function that is called when the page is initialized:</p>
<pre class="brush: javascript">
function initializeDeleteItemDialog() {
var doOk= function() {
var paramsdata = {
&quot;productId&quot; : $(&quot;#bpvremoveitemid&quot;).val()
}
$.ajax({
type: &quot;POST&quot;, url: &quot;/_layouts/intranet2009/bpvshoppingcart.asmx/DeleteItem&quot;,
data: JSON.stringify(paramsdata),
contentType: &quot;application/json;charset=utf-8&quot;,
dataType: &quot;json&quot;,
success:rendershoppingcart,
error: showError
});

$(&quot;#bpvremoveitemdialog&quot;).dialog(&quot;close&quot;);
}
var doCancel = function()
{
$(&quot;#bpvremoveitemdialog&quot;).dialog(&quot;close&quot;);
}
var dialogOpts = {
modal: true,
buttons: {&quot;Bewaren&quot;: doCancel, &quot;Verwijderen&quot;: doOk},
autoOpen: false
}
$(&quot;#bpvremoveitemdialog&quot;).dialog(dialogOpts);
}
</pre>
<p>We first specify the code to execute when the user presses the Ok button. In this case we’ll call the DeleteItem method of the shoppingcart web service and then close the dialog. The Cancel button will close the dialog straight away. In the dialog options we specify the buttons with their callback. Then we hook up the dialog to the html element we want to show. The html is written out in the Render method of the web part:</p>
<pre class="brush: javascript">
writer.WriteLine(“&lt;div id=\”bpvremoveitemdialog\” title=\”Product verwijderen?\”&gt;”);
writer.WriteLine(“Weet u zeker dat u dit product uit uw winkelwagen wilt verwijderen?”);
writer.WriteLine(“&lt;input type=\”hidden\” id=\”bpvremoveitemid\”/&gt;”);
writer.WriteLine(“&lt;/div&gt;”);
</pre>
<p>To open the dialog we just have to call the dialog method again with “open” as parameter:</p>
<pre class="brush: javascript">
function removeProduct(element) {
$(&quot;#bpvremoveitemid&quot;).val($(element).attr(&quot;productid&quot;) );
$(&quot;#bpvremoveitemdialog&quot;).dialog(&quot;open&quot;);
}
</pre>
<p><strong>Validation</strong></p>
<p>Validation of your inputs is supposed to be really easy with the <a  href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" target="_blank">validation plugin</a>. Unfortunately this doesn’t count when you combine it with ASP.Net Webforms. With the validation plugin you attach the validation to a form within your html. Because ASP.Net Webforms uses one form tag for the entire page, this doesn’t allow you to set validation to a group of elements that would normally be contained within their own form tag. The solution I came up with for now only validates 1 element at a time.<br />
If you now of a way to assign one validation and remove it again before assigning a new validation, let me know.</p>
<p>First we hook up all the validations we want on the form and we specify a custom validation<br />
rule, called dutchDate:</p>
<pre class="brush: javascript">
$.validator.addMethod(
&quot;dutchDate&quot;, function(value,element)
{ return value.match(/^\d\d?\/\d\d?\/\d\d\d\d$/);},
&quot;Voer een datum in van het formaat dd/mm/yyyy&quot; );
$(&quot;form&quot;).validate({
onsubmit: false,
onfocusout: false,
onkeyup: false,
onclick: false,
showErrors: showValidationError,
rules: {
bpvproductamount: {
required: true,
number: true
},
bpvproductid: {
required: true
},
bpvorderdate: {
required: true,
dutchDate: true
}
},
messages: {
bpvproductamount: {
required: &quot;Aantal is een verplicht veld&quot;,
number: &quot;Aantal moet een getal zijn&quot;
},
bpvproductid: {
required: &quot;U heeft geen product geselecteerd&quot; },
bpvorderdate: {
required: &quot;Bezorg-/ophaaldatum is een verplicht veld&quot;,
dutchDate: &quot;Bezorg-/ophaaldatum moet in het formaat dd/mm/yyyy zijn&quot;
}
}
});
</pre>
<p>I only want the validation to occur when I call it on specific elements from code, so we specify false on every event it normally triggers on. When there are errors,  I want to call a showValidationError function that shows the errors in a dialog box. Then we specify the rules and the messages we want to show when the rule isn’t matched. “bpvproductamount” equals the name attribute of the input element.</p>
<p>To call the validation we use the element method of the validation plugin:</p>
<pre class="brush: javascript">
if ($(&quot;form&quot;).validate().element(&quot;#txtbpvproductid&quot;) &amp;&amp; $(&quot;form&quot;).validate().element(&quot;#txtbpvproductamount&quot;))
{
// valid, so perfom actions
}
</pre>
<p>As soon as an element doesn’t pass validation, the method we attached to the showErrors event is called. Unfortunately this means only one error at a time will popup if multiple  elements don’t pass validation. To show the validation messages, we’ll make use of the Dialog widget once again:</p>
<pre class="brush: javascript">
function showValidationError(errorMap, errorList)
{
var message = &quot;&quot;;
var i;
for(i=0; i &lt; errorList.length; i++) {
message += errorList[i].message + &quot;&lt;br /&gt;&quot;;
}
if (message.length &gt; 0) {
showMessage(message);
}
}
</pre>
<h4>Conclusion</h4>
<p>Building an AJAX web part with jQuery (and some plugins) can result in a very responsive UI with a good user experience. In the end, I don’t think building a web part with ASP.Net AJAX would have taken me less time as well. I’m not happy with the validation though. Although the jQuery validation plugin is very useful in most web frameworks (including ASP.Net MVC), it seems that it doesn’t combine well with web forms. But I haven’t been able to find a better plugin for it.</p>
<!-- RO Social Bookmarks BEGIN --><div class="social_bookmark"><em>Bookmark to:</em><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/" title="Add 'Building an AJAX web part with jQuery (Part 3)' to Twitter"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/twitter.png" title="Add 'Building an AJAX web part with jQuery (Part 3)' to Twitter" alt="Add 'Building an AJAX web part with jQuery (Part 3)' to Twitter" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.myspace.com/Modules/PostTo/Pages/?t=Building+an+AJAX+web+part+with+jQuery+%28Part+3%29&#038;c=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/" title="Add 'Building an AJAX web part with jQuery (Part 3)' to MySpace"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/myspace.png" title="Add 'Building an AJAX web part with jQuery (Part 3)' to MySpace" alt="Add 'Building an AJAX web part with jQuery (Part 3)' to MySpace" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/&#038;title=Building+an+AJAX+web+part+with+jQuery+%28Part+3%29" title="Add 'Building an AJAX web part with jQuery (Part 3)' to Del.icio.us"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/delicious.png" title="Add 'Building an AJAX web part with jQuery (Part 3)' to Del.icio.us" alt="Add 'Building an AJAX web part with jQuery (Part 3)' to Del.icio.us" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&#038;url=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/&#038;title=Building+an+AJAX+web+part+with+jQuery+%28Part+3%29" title="Add 'Building an AJAX web part with jQuery (Part 3)' to digg"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/digg.png" title="Add 'Building an AJAX web part with jQuery (Part 3)' to digg" alt="Add 'Building an AJAX web part with jQuery (Part 3)' to digg" /></a><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/&#038;t=Building+an+AJAX+web+part+with+jQuery+%28Part+3%29" title="Add 'Building an AJAX web part with jQuery (Part 3)' to FaceBook"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/facebook.png" title="Add 'Building an AJAX web part with jQuery (Part 3)' to FaceBook" alt="Add 'Building an AJAX web part with jQuery (Part 3)' to FaceBook" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/" title="Add 'Building an AJAX web part with jQuery (Part 3)' to Technorati"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/technorati.png" title="Add 'Building an AJAX web part with jQuery (Part 3)' to Technorati" alt="Add 'Building an AJAX web part with jQuery (Part 3)' to Technorati" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/&#038;title=Building+an+AJAX+web+part+with+jQuery+%28Part+3%29" title="Add 'Building an AJAX web part with jQuery (Part 3)' to Stumble Upon"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/stumbleupon.png" title="Add 'Building an AJAX web part with jQuery (Part 3)' to Stumble Upon" alt="Add 'Building an AJAX web part with jQuery (Part 3)' to Stumble Upon" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&#038;output=popup&#038;bkmk=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/&#038;title=Building+an+AJAX+web+part+with+jQuery+%28Part+3%29" title="Add 'Building an AJAX web part with jQuery (Part 3)' to Google Bookmarks"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/google.png" title="Add 'Building an AJAX web part with jQuery (Part 3)' to Google Bookmarks" alt="Add 'Building an AJAX web part with jQuery (Part 3)' to Google Bookmarks" /></a></div>
<!-- RO Social Bookmarks END --><p><a  href="http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/">Building an AJAX web part with jQuery (Part 3)</a> is a post from: <a  href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
<div class="fblike" style="height:25px; height:25px; overflow:hidden;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.petergerritsen.nl%2F2009%2F03%2F31%2Fbuilding-an-ajax-web-part-with-jquery-part-3%2F&amp;layout=standard&amp;show_faces=false&amp;width=320&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allow Transparency="true" style="border:none; overflow:hidden; width:320px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building an AJAX web part with jQuery (Part 2)</title>
		<link>http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss</link>
		<comments>http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 10:29:31 +0000</pubDate>
		<dc:creator>Peter Gerritsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MOSS]]></category>

		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/</guid>
		<description><![CDATA[In part 1 of this series I explained a bit about the context and goal of creating an AJAX web part without using ASP.Net AJAX. I also showed the steps necessary for creating services that return data in the JSON format. In this post I’ll show you how to call these services from JavaScript and insert the data in [...]<p><a href="http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/">Building an AJAX web part with jQuery (Part 2)</a> is a post from: <a href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>In <a  href="http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/" target="_blank">part 1</a> of this series I explained a bit about the context and goal of creating an AJAX web part without using ASP.Net AJAX. I also showed the steps necessary for creating services that return data in the JSON format. In this post I’ll show you how to call these services from JavaScript and insert the data in the HTML placeholders rendered by the web part.</p>
<p><strong>Calling the generic handler for products and categories</strong></p>
<p>jQuery offers various methods to perform asynchronous calls to web resources. To retrieve JSON the most used are jQuery.ajax and jQuery.getJSON. The last one uses a HTTP GET request and is simpler to use, the jQuery.ajax method offers more options/flexibility. For retrieving the product categories and the products, I’ve decided to go with getJSON.<br />
The code for retreiving the categories looks as follows:</p>
<pre class="brush: javascript">
function showProductCategories() {
$.getJSON(bpvweburl + &quot;/_layouts/intranet2009/bpv.ashx&quot;,
{type: &quot;categories&quot;},
function(data)
{
var categoriescontainer = $(&quot;#bpvcategoriescontainer&quot;);
categoriescontainer.empty();
var list = categoriescontainer.append($(&quot;#bpvcategorytemplate&quot;).html());
var directive = {&#039;a.context[onclick]&#039; : &#039;&quot;showProducts(this);return false;&quot;&#039;};
list.autoRender( data, directive );
});
}
</pre>
<p>The first line is responsible for calling the handler. It specifies a inline callback method to handle the returned data. The JSON returned is processed by the PURE templating plugin. I’ve blogged about using this <a  href="http://blog.petergerritsen.nl/2009/03/13/using-a-template-plugin-for-jquery-to-parse-json-data/" target="_blank">before</a>.</p>
<p><strong>Calling the shopping cart web service</strong></p>
<p>For getting the data from the web service, we’ll use the jQuery.ajax method. That’s because we need to do a HTTP POST request as well as specify some other options for the request. For more information see <a  href="http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/" target="_blank">this</a> post by Dave Ward. To initially load the shopping cart we use the following code:</p>
<pre class="brush: javascript">
function loadShoppingcart()
{
$.ajax({
type: &quot;POST&quot;,
url: &quot;/_layouts/ecabointranet2009/bpvshoppingcart.asmx/GetItems&quot;,
data: &quot;{}&quot;,
contentType: &quot;application/json; charset=utf-8&quot;,
dataType: &quot;json&quot;,
success: rendershoppingcart,
error: showError
});
}

function rendershoppingcart(msg) {
var cartcontainer = $(&quot;#bpvcartcontent&quot;);
cartcontainer.empty();

if (msg.d.length &gt; 0)
{
var cartitemslist = cartcontainer.append($(&quot;#bpvcarttemplate&quot;).html());

var directives = {
&#039;a.bpvedit[onclick]&#039; : &#039;&quot;editAmount(this); return false;&quot;&#039;,
&#039;a.bpvremove[onclick]&#039; : &#039;&quot;removeProduct(this); return false;&quot;&#039;
}
cartitemslist.autoRender( msg.d, directives );
}
else
{
cartcontainer.append(&quot;&lt;span&gt;U heeft nog geen producten in uw winkelwagen&lt;/span&gt;&quot;);

}

$(&quot;#bpvcartcontent&quot;).effect(&quot;highlight&quot;, {color: &quot;#ffcf57&quot;}, 700, null);
}

function showError(xhr, status, error)
{
var err = eval(&quot;(&quot; + xhr.responseText + &quot;)&quot;);

$(&quot;#bpverrordialog span.errormessage&quot;).html(err.Message);

$(&quot;#bpverrordialog&quot;).dialog(&quot;open&quot;);
}
</pre>
<p>As you can see we post to the GetItems method of the asmx. We need to specify a empty JSON object as data (more information on that in <a  href="http://encosia.com/2008/06/05/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/" target="_blank">this</a> post, again by Dave Ward) and specify the contentType we want returned. When the AJAX call returns an error, we’ll call the showError method (which uses the jQuery UI dialog widget I’ll tell more about in part 3). When the call is successful, the rendershoppingcart method is called. This checks if the cart is empty, so we can display a message in that case, or uses PURE again for rendering the cart contents. To provide visual feedback to the user when the cart is updated, we’ll use the highlight effect on the cart to attract the attention of the user.<br />
If we want to pass in parameters with an AJAX call (like the productId when we want to delete an item from the cart), we need to construct a parameters object and serialize that as string for usage in the call:</p>
<pre class="brush: javascript">
var paramsdata = { &quot;productId&quot; : $(&quot;#bpvremoveitemid&quot;).val() }

$.ajax({
type: &quot;POST&quot;,
url: &quot;/_layouts/ecabointranet2009/bpvshoppingcart.asmx/DeleteItem&quot;,
data: JSON.stringify(paramsdata),
contentType: &quot;application/json; charset=utf-8&quot;,
dataType: &quot;json&quot;,
success: rendershoppingcart,
error: showError
});
</pre>
<p>As you can see, we use a JSON.stringify method for serializing the object as a string.</p>
<p>You can <a  href="http://www.json.org/json2.js" target="_blank">download</a> the scriptfile needed for this from JSON.org.</p>
<p>All the other methods in the web service are called in the same way, so there’s no need to inundate you with more code on that. The only thing left is to show you parts of the contents of the Render method in the webpart:</p>
<pre class="brush: csharp">
// Templates
// Categorylist template
writer.WriteLine(&quot;&lt;div id=\&quot;bpvcategorytemplate\&quot; style=\&quot;display: none;\&quot;&gt;&quot;);
writer.WriteLine(&quot;&lt;h3&gt;Productcategorie&lt;/h3&gt;&quot;);
writer.WriteLine(&quot;&lt;ul&gt;&lt;li class=\&quot;context\&quot;&gt;&lt;a href=\&quot;#\&quot; class=\&quot;context context@category\&quot;&gt;laden...&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&quot;);
writer.WriteLine(&quot;&lt;/div&gt;&quot;);
// Productlist template
writer.WriteLine(&quot;&lt;div id=\&quot;bpvproducttemplate\&quot; style=\&quot;display: none;\&quot;&gt;&quot;);
writer.WriteLine(&quot;&lt;h3&gt;Product&lt;/h3&gt;&quot;);
writer.WriteLine(&quot;&lt;ul&gt;&lt;li class=\&quot;context\&quot;&gt;&lt;a href=\&quot;#\&quot; class=\&quot;Title ID@productid Description@description Code@productcode AttachmentUrl@imageurl\&quot;&gt;geen items&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&quot;);
writer.WriteLine(&quot;&lt;/div&gt;&quot;);
// Shoppingcart template
writer.WriteLine(&quot;&lt;div id=\&quot;bpvcarttemplate\&quot; style=\&quot;display: none;\&quot;&gt;&quot;);
writer.WriteLine(&quot;&lt;h3&gt;Informatie en bestellen&lt;/h3&gt;&quot;);
writer.WriteLine(&quot;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;td class=\&quot;ProductName\&quot;&gt;Product&lt;/td&gt;&lt;td&gt;Aantal&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody class=\&quot;d\&quot;&gt;&quot;);
writer.WriteLine(&quot;&lt;tr class=\&quot;context\&quot;&gt;&lt;td class=\&quot;ProductName\&quot;&gt;naam&lt;/td&gt;&lt;td class=\&quot;Amount\&quot;&gt;aantal&lt;/td&gt;&lt;td&gt;&lt;a href=\&quot;#\&quot; class=\&quot;bpvedit ProductID@productid Amount@amount\&quot;&gt;&lt;img src=\&quot;/_layouts/images/ecabo/2009/page-edit.gif\&quot; /&gt;&lt;/a&gt; &lt;a href=\&quot;#\&quot; class=\&quot;bpvremove ProductID@productid\&quot;&gt;&lt;img src=\&quot;/_layouts/images/ecabo/2009/bin.gif\&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&quot;);
writer.WriteLine(&quot;&lt;/tbody&gt;&lt;/table&gt;&quot;);
writer.WriteLine(&quot;&lt;/div&gt;&quot;);

// Item selector
writer.WriteLine(&quot;&lt;div id=\&quot;bpvitemselector\&quot;&gt;&quot;);
writer.WriteLine(&quot;&lt;h2&gt;1. Selecteer uw producten&lt;/h2&gt;&quot;);
writer.WriteLine(&quot;&lt;div id=\&quot;selector\&quot;&gt;&quot;);
writer.WriteLine(&quot;&lt;div id=\&quot;bpvcategoriescontainer\&quot;&gt;&lt;h3&gt;Productcategorie&lt;/h3&gt;&lt;/div&gt;&quot;);
writer.WriteLine(&quot;&lt;div id=\&quot;bpvproductscontainer\&quot;&gt;&lt;h3&gt;Product&lt;/h3&gt;&lt;/div&gt;&quot;);
writer.WriteLine(&quot;&lt;/div&gt;&quot;);
writer.WriteLine(&quot;&lt;div id=\&quot;bpvproductinfo\&quot;&gt;&lt;h3&gt;Informatie en bestellen&lt;/h3&gt;&quot;);
writer.WriteLine(&quot;&lt;img src=\&quot;/_layouts/images/blank.gif\&quot; id=\&quot;bpvproductimage\&quot;/&gt;&quot;);
writer.WriteLine(&quot;&lt;span class=\&quot;title\&quot; id=\&quot;bpvproducttitle\&quot;&gt;&lt;/span&gt;&quot;);
writer.WriteLine(&quot;&lt;span class=\&quot;description\&quot;  id=\&quot;bpvproductdescription\&quot; /&gt;&lt;/span&gt;&quot;);
writer.WriteLine(&quot;&lt;label class=\&quot;amount\&quot;&gt;Aantal:&lt;/label&gt;&lt;input type=\&quot;text\&quot; id=\&quot;txtbpvproductamount\&quot; name=\&quot;bpvproductamount\&quot;/&gt;&quot;);
writer.WriteLine(&quot;&lt;input type=\&quot;hidden\&quot; id=\&quot;txtbpvproductid\&quot; name=\&quot;bpvproductid\&quot;/&gt;&quot;);
writer.WriteLine(&quot;&lt;input type=\&quot;hidden\&quot; id=\&quot;txtbpvproductcode\&quot; /&gt;&quot;);
writer.WriteLine(&quot;&lt;input type=\&quot;button\&quot; id=\&quot;bpvaddproduct\&quot; value=\&quot;Voeg toe\&quot;/&gt;&quot;);
writer.WriteLine(&quot;&lt;/div&gt;&quot;);
writer.WriteLine(&quot;&lt;/div&gt;&quot;);

// Shoppingcart
writer.WriteLine(&quot;&lt;div id=\&quot;bpvshoppingcart\&quot;&gt;&quot;);
writer.WriteLine(&quot;&lt;h2&gt;2. Lijst met uw bestelling&lt;/h2&gt;&quot;);
writer.WriteLine(&quot;&lt;div id=\&quot;bpvcartcontent\&quot;&gt;&lt;span&gt;U heeft nog geen producten in uw winkelwagen&lt;/span&gt;&lt;/div&gt;&quot;);

writer.WriteLine(&quot;&lt;a id=\&quot;clearcart\&quot; href=\&quot;#\&quot; onclick=\&quot;clearCart(); return false;\&quot;&gt;Alles verwijderen&lt;/a&gt;&quot;);
writer.WriteLine(&quot;&lt;/div&gt;&quot;);
</pre>
<p>As you can see, all we do is write out HTML. First I write out the HTML needed for the databinding of the categories and products (I removed that because it’s the same as the category one). Then some placeholders and form elements are rendered. There’s a little more HTML off course, but you get the point, NO CODE <img src='http://blog.petergerritsen.nl/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>In the <a  href="http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-3/" target="_blank">next part</a> I’ll show you how to use some jQuery plugins to enhance the experience of the user and validation of the input.</p>
<!-- RO Social Bookmarks BEGIN --><div class="social_bookmark"><em>Bookmark to:</em><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/" title="Add 'Building an AJAX web part with jQuery (Part 2)' to Twitter"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/twitter.png" title="Add 'Building an AJAX web part with jQuery (Part 2)' to Twitter" alt="Add 'Building an AJAX web part with jQuery (Part 2)' to Twitter" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.myspace.com/Modules/PostTo/Pages/?t=Building+an+AJAX+web+part+with+jQuery+%28Part+2%29&#038;c=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/" title="Add 'Building an AJAX web part with jQuery (Part 2)' to MySpace"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/myspace.png" title="Add 'Building an AJAX web part with jQuery (Part 2)' to MySpace" alt="Add 'Building an AJAX web part with jQuery (Part 2)' to MySpace" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/&#038;title=Building+an+AJAX+web+part+with+jQuery+%28Part+2%29" title="Add 'Building an AJAX web part with jQuery (Part 2)' to Del.icio.us"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/delicious.png" title="Add 'Building an AJAX web part with jQuery (Part 2)' to Del.icio.us" alt="Add 'Building an AJAX web part with jQuery (Part 2)' to Del.icio.us" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&#038;url=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/&#038;title=Building+an+AJAX+web+part+with+jQuery+%28Part+2%29" title="Add 'Building an AJAX web part with jQuery (Part 2)' to digg"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/digg.png" title="Add 'Building an AJAX web part with jQuery (Part 2)' to digg" alt="Add 'Building an AJAX web part with jQuery (Part 2)' to digg" /></a><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/&#038;t=Building+an+AJAX+web+part+with+jQuery+%28Part+2%29" title="Add 'Building an AJAX web part with jQuery (Part 2)' to FaceBook"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/facebook.png" title="Add 'Building an AJAX web part with jQuery (Part 2)' to FaceBook" alt="Add 'Building an AJAX web part with jQuery (Part 2)' to FaceBook" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/" title="Add 'Building an AJAX web part with jQuery (Part 2)' to Technorati"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/technorati.png" title="Add 'Building an AJAX web part with jQuery (Part 2)' to Technorati" alt="Add 'Building an AJAX web part with jQuery (Part 2)' to Technorati" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/&#038;title=Building+an+AJAX+web+part+with+jQuery+%28Part+2%29" title="Add 'Building an AJAX web part with jQuery (Part 2)' to Stumble Upon"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/stumbleupon.png" title="Add 'Building an AJAX web part with jQuery (Part 2)' to Stumble Upon" alt="Add 'Building an AJAX web part with jQuery (Part 2)' to Stumble Upon" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&#038;output=popup&#038;bkmk=http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/&#038;title=Building+an+AJAX+web+part+with+jQuery+%28Part+2%29" title="Add 'Building an AJAX web part with jQuery (Part 2)' to Google Bookmarks"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/google.png" title="Add 'Building an AJAX web part with jQuery (Part 2)' to Google Bookmarks" alt="Add 'Building an AJAX web part with jQuery (Part 2)' to Google Bookmarks" /></a></div>
<!-- RO Social Bookmarks END --><p><a  href="http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/">Building an AJAX web part with jQuery (Part 2)</a> is a post from: <a  href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
<div class="fblike" style="height:25px; height:25px; overflow:hidden;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.petergerritsen.nl%2F2009%2F03%2F31%2Fbuilding-an-ajax-web-part-with-jquery-part-2%2F&amp;layout=standard&amp;show_faces=false&amp;width=320&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allow Transparency="true" style="border:none; overflow:hidden; width:320px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building an AJAX web part with jQuery (Part 1)</title>
		<link>http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss</link>
		<comments>http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 10:08:51 +0000</pubDate>
		<dc:creator>Peter Gerritsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MOSS]]></category>

		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/</guid>
		<description><![CDATA[In this series of posts I will describe how I build a web part full of AJAX functionality using jQuery and some plugins for jQuery. Why? ASP.Net AJAX is quite hard to implement using only code. Besides that, having multiple updatepanels and multiple triggers outside of these updatepanels, can complicate stuff very quickly. So I decided to see [...]<p><a href="http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/">Building an AJAX web part with jQuery (Part 1)</a> is a post from: <a href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>In this series of posts I will describe how I build a web part full of AJAX functionality using jQuery and some plugins for jQuery.</p>
<h4>Why?</h4>
<p>ASP.Net AJAX is quite hard to implement using only code. Besides that, having multiple updatepanels and multiple triggers outside of these updatepanels, can complicate stuff very quickly. So I decided to see how much time I would need to build the required functionality using JavaScript with jQuery.</p>
<p><strong>What?</strong></p>
<p>The web part of choice was one that would allow visitors of the portal to order a bunch of products from different categories. Products are stored in a list and have a choice sitecolumn to specify the category of the item. Products can be selected and added to a shopping cart. After the wanted items are added to the shopping cart, the user can specify some comments, a handling method (Pick-up or deliver) and a delivery-/pickup date and send in the order. The order information is saved in a list, the user gets a confirmation email and the shopping cart is cleared. The resulting web part look like this (sorry for the dutch interface):</p>
<p><a  href="http://blog.petergerritsen.nl/wp-content/uploads/snipping24.png" class="thickbox no_icon" rel="gallery-562" title="image"><img style="display: inline; border-width: 0px;" title="image" src="http://blog.petergerritsen.nl/wp-content/uploads/snipping25.png" border="0" alt="image" /></a></p>
<p><strong>How?</strong></p>
<p>For getting the categories and products we’ll use a generic handler. This offers the possibility of caching and is perfectly suitable for read-only data access. The shopping cart and order functionality will be provided through a ASP.Net Webservice. Both the handler and web service will return JSON data. We’ll need ASP.Net 3.5 for this.</p>
<p>The web part will only override the render method and write out the needed HTML. So no control instantiation, event handling or other code.</p>
<p><strong>Useful links</strong></p>
<p>Dave Ward’s weblog on <a  href="http://encosia.com/" target="_blank">encosia.com</a> provides a vital source for information on combining jQuery and ASP.Net. Also <a  href="http://www.west-wind.com/Weblog/" target="_blank">Rick Strahl</a> has some useful posts on this subject.</p>
<p><strong>Building the products handler</strong></p>
<p>We’ll start by building the Generic Handler that returns JSON data for categories and products. We’ll differentiate between the two by passing in the type with the query string. I’ve created two classes for data retrieval from the list in SharePoint, one that returns the choices of the categories and one that returns the products based on the category. We’ll then use the DataContractJsonSerializer to generate and return the JSON for this data:</p>
<pre class="brush: csharp">
public void ProcessRequest(HttpContext context)
{
try
{
if (string.IsNullOrEmpty(context.Request[&quot;type&quot;]))
throw new ArgumentException(&quot;type not specified or null&quot;);

string type = context.Request[&quot;type&quot;];

context.Response.Cache.SetExpires(DateTime.Now.AddSeconds(300));
context.Response.Cache.SetCacheability(HttpCacheability.Public);

if (type.Equals(&quot;categories&quot;, StringComparison.InvariantCultureIgnoreCase))
{
StringCollection categories = BPVProductCategory.GetProductCategories();

DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(StringCollection));
ser.WriteObject(context.Response.OutputStream, categories);
}
if (type.Equals(&quot;products&quot;, StringComparison.InvariantCultureIgnoreCase))
{
if (string.IsNullOrEmpty(context.Request[&quot;category&quot;]))
throw new ArgumentException(&quot;category not specified or null&quot;);

string category = HttpUtility.UrlDecode(context.Request[&quot;category&quot;]);

Ecabo.Intranet2009.SharePoint.Diagnostics.Logging.LogMessageFormat(&quot;Category: {0}&quot;, category);

List&lt;bpvproduct&gt; products = BPVProduct.GetAvailableProducts(category);

DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(List&lt;bpvproduct&gt;));
ser.WriteObject(context.Response.OutputStream, products);
}
}
catch (Exception ex)
{
context.Response.Write(string.Format(&quot;ERROR: {0}&quot;, ex.Message));
}
}
</pre>
<h4>Building the shopping cart web service</h4>
<p>Next, we need to create a web service that will allows us to modify the shopping cart with add, remove, change and clear methods. This web service will also contain a method to place the order. To make sure this web service will return JSON when requested, we’ll decorate the class with the ScriptService attribute (normally you just have to comment out the automatically included line in the class definition) and we decorate<br />
the methods with the ScriptMethod attribute in which we specify the ResponseFormat to be JSON. To store the shoppingcart between requests to the service we’ll use the Session. In order for that to work we add the EnableSession=true parameter to the WebMethod attribute of each method. The resulting code looks like this:</p>
<pre class="brush: csharp">
[WebService(Namespace = &quot;http://sharepoint.ecabo.nl/200903/&quot;)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class BPVShoppingCart : System.Web.Services.WebService
{
private List&lt;shoppingCartItem&gt; ShoppingCart
{
get
{
if (HttpContext.Current.Session[&quot;BPVShoppingCart&quot;] != null)
{
return (List&lt;shoppingCartItem&gt;)HttpContext.Current.Session[&quot;BPVShoppingCart&quot;];
}
else
{
List&lt;shoppingCartItem&gt; shoppingCart = new List&lt;shoppingCartItem&gt;();
HttpContext.Current.Session.Add(&quot;BPVShoppingCart&quot;, shoppingCart);
return shoppingCart;
}
}
set
{
HttpContext.Current.Session[&quot;BPVShoppingCart&quot;] = value;
}
}

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List&lt;shoppingCartItem&gt; GetItems()
{
try
{
return ShoppingCart;
}
catch (Exception ex)
{
Ecabo.Intranet2009.SharePoint.Diagnostics.Logging.LogException(ex);
return null;
}
}

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List&lt;shoppingCartItem&gt; AddItem(string productName, int productId, string productCode, int amount)
{
try
{
ShoppingCartItem item = ShoppingCart.Find(p =&gt; p.ProductID == productId);
if (item == null)
{
item = new ShoppingCartItem();
item.Amount = amount;
item.ProductCode = productCode;
item.ProductID = productId;
item.ProductName = productName;
ShoppingCart.Add(item);
}
else
{
item.Amount += amount;
}

return ShoppingCart;
}
catch (Exception ex)
{
Ecabo.Intranet2009.SharePoint.Diagnostics.Logging.LogException(ex);
return null;
}
}

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List&lt;shoppingCartItem&gt; DeleteItem(int productId)
{
try
{
ShoppingCartItem item = ShoppingCart.Find(p =&gt; p.ProductID == productId);
if (item != null)
{
ShoppingCart.Remove(item);
}

return ShoppingCart;
}
catch (Exception ex)
{
Ecabo.Intranet2009.SharePoint.Diagnostics.Logging.LogException(ex);
return null;
}
}

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List&lt;shoppingCartItem&gt; ChangeAmount(int productId, int amount)
{
try
{
if (amount == 0)
return DeleteItem(productId);

ShoppingCartItem item = ShoppingCart.Find(p =&gt; p.ProductID == productId);
if (item != null)
{
item.Amount = amount;
}

return ShoppingCart;
}
catch (Exception ex)
{
Ecabo.Intranet2009.SharePoint.Diagnostics.Logging.LogException(ex);
return null;
}
}

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List&lt;shoppingCartItem&gt; ClearCart()
{
try
{
ShoppingCart.Clear();
return ShoppingCart;
}
catch (Exception ex)
{
Ecabo.Intranet2009.SharePoint.Diagnostics.Logging.LogException(ex);
return null;
}
}

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List&lt;shoppingCartItem&gt; PlaceOrder(string comments, string deliveryType, string deliveryDate)
{
try
{
string products = &quot;&quot;;

foreach (ShoppingCartItem item in ShoppingCart)
{
products += string.Format(&quot;{0} - {1} - {2}\r\n&quot;, item.ProductCode, item.Amount, item.ProductName);
}

BPVBestelling bestelling = new BPVBestelling();
bestelling.Comments = comments;
bestelling.Handling = deliveryType;
bestelling.HandlingDate = Convert.ToDateTime(deliveryDate, new CultureInfo(&quot;nl-NL&quot;));
bestelling.Title = DateTime.Now.ToString(&quot;yyyyMMdd_HHmm&quot;) + &quot;_&quot; + SPContext.Current.Web.CurrentUser.Email;
bestelling.Products = products;
bestelling.PlacedBy = SPContext.Current.Web.CurrentUser;

if (BPVBestelling.AddBestelling(bestelling))
{
BPVBestelling.SendConfirmationEmail(bestelling, ShoppingCart);
ShoppingCart.Clear();
return ShoppingCart;
}
else
throw new Exception(&quot;Het is niet mogelijk om uw bestelling te verwerken&quot;);
}
catch (Exception ex)
{
Ecabo.Intranet2009.SharePoint.Diagnostics.Logging.LogException(ex);
throw new Exception(&quot;Het is niet mogelijk om uw bestelling te verwerken&quot;, ex);
}
}
}
</pre>
<p>There’s one more thing needed for letting the web service return the data in JSON format. We need to include a httpHandler in the web.config for the asmx extension that routes the request to the ScriptHandlerFactory. An easy way to do this is for your SharePoint webapp by creating a blank web.config and placing it in a subfolder of the layouts directory where you also place the asmx file. The following is all you need in that web.config file:</p>
<pre class="brush: xml">
&lt;?xml version=&quot;1.0&quot; standalone=&quot;yes&quot;?&gt;
&lt;configuration&gt;
&lt;system.web&gt;
&lt;httpHandlers&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.asmx&quot; validate=&quot;false&quot; type=&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot;/&gt;
&lt;/httpHandlers&gt;
&lt;compilation debug=&quot;true&quot;/&gt;&lt;/system.web&gt;
&lt;/configuration&gt;
</pre>
<p><strong>Next parts</strong></p>
<p>That wraps it up for this first post in the series. In <a  href="http://blog.petergerritsen.nl/2009/03/31/building-an-ajax-web-part-with-jquery-part-2/" target="_blank">part 2</a> I’ll show you how to call these services from jQuery and insert the data in the HTML of the webpart. In <a  href="http://blog.petergerritsen.nl/2009/05/16/what-asp-net-developers-should-know-about-jquery/" target="_blank">part 3</a> we’ll enhance the experience by including dialogs and validation in the solution.</p>
<!-- RO Social Bookmarks BEGIN --><div class="social_bookmark"><em>Bookmark to:</em><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/" title="Add 'Building an AJAX web part with jQuery (Part 1)' to Twitter"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/twitter.png" title="Add 'Building an AJAX web part with jQuery (Part 1)' to Twitter" alt="Add 'Building an AJAX web part with jQuery (Part 1)' to Twitter" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.myspace.com/Modules/PostTo/Pages/?t=Building+an+AJAX+web+part+with+jQuery+%28Part+1%29&#038;c=http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/" title="Add 'Building an AJAX web part with jQuery (Part 1)' to MySpace"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/myspace.png" title="Add 'Building an AJAX web part with jQuery (Part 1)' to MySpace" alt="Add 'Building an AJAX web part with jQuery (Part 1)' to MySpace" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/&#038;title=Building+an+AJAX+web+part+with+jQuery+%28Part+1%29" title="Add 'Building an AJAX web part with jQuery (Part 1)' to Del.icio.us"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/delicious.png" title="Add 'Building an AJAX web part with jQuery (Part 1)' to Del.icio.us" alt="Add 'Building an AJAX web part with jQuery (Part 1)' to Del.icio.us" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&#038;url=http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/&#038;title=Building+an+AJAX+web+part+with+jQuery+%28Part+1%29" title="Add 'Building an AJAX web part with jQuery (Part 1)' to digg"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/digg.png" title="Add 'Building an AJAX web part with jQuery (Part 1)' to digg" alt="Add 'Building an AJAX web part with jQuery (Part 1)' to digg" /></a><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/&#038;t=Building+an+AJAX+web+part+with+jQuery+%28Part+1%29" title="Add 'Building an AJAX web part with jQuery (Part 1)' to FaceBook"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/facebook.png" title="Add 'Building an AJAX web part with jQuery (Part 1)' to FaceBook" alt="Add 'Building an AJAX web part with jQuery (Part 1)' to FaceBook" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/" title="Add 'Building an AJAX web part with jQuery (Part 1)' to Technorati"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/technorati.png" title="Add 'Building an AJAX web part with jQuery (Part 1)' to Technorati" alt="Add 'Building an AJAX web part with jQuery (Part 1)' to Technorati" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/&#038;title=Building+an+AJAX+web+part+with+jQuery+%28Part+1%29" title="Add 'Building an AJAX web part with jQuery (Part 1)' to Stumble Upon"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/stumbleupon.png" title="Add 'Building an AJAX web part with jQuery (Part 1)' to Stumble Upon" alt="Add 'Building an AJAX web part with jQuery (Part 1)' to Stumble Upon" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&#038;output=popup&#038;bkmk=http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/&#038;title=Building+an+AJAX+web+part+with+jQuery+%28Part+1%29" title="Add 'Building an AJAX web part with jQuery (Part 1)' to Google Bookmarks"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/google.png" title="Add 'Building an AJAX web part with jQuery (Part 1)' to Google Bookmarks" alt="Add 'Building an AJAX web part with jQuery (Part 1)' to Google Bookmarks" /></a></div>
<!-- RO Social Bookmarks END --><p><a  href="http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/">Building an AJAX web part with jQuery (Part 1)</a> is a post from: <a  href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
<div class="fblike" style="height:25px; height:25px; overflow:hidden;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.petergerritsen.nl%2F2009%2F03%2F30%2Fbuilding-an-ajax-web-part-with-jquery-part-1%2F&amp;layout=standard&amp;show_faces=false&amp;width=320&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allow Transparency="true" style="border:none; overflow:hidden; width:320px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://blog.petergerritsen.nl/2009/03/30/building-an-ajax-web-part-with-jquery-part-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MOSS Search and browser languages</title>
		<link>http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss</link>
		<comments>http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 21:03:01 +0000</pubDate>
		<dc:creator>Peter Gerritsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/</guid>
		<description><![CDATA[We had a very strange issue with some search functionality we developed for a portal. We created an option to search for documents in a library by specifying the path to a specific folder. This is done by specifying a keyword query like 9:”folder/subfolder”. In this case the searchproperty 9 contains the path of the item. While this [...]<p><a href="http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/">MOSS Search and browser languages</a> is a post from: <a href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>We had a very strange issue with some search functionality we developed for a portal. We created an option to search for documents in a library by specifying the path to a specific folder.</p>
<p>This is done by specifying a keyword query like <em>9:”folder/subfolder”</em>. In this case the searchproperty <em>9</em> contains the path of the item.</p>
<p>While this worked well on our development environments and most of the browsers we tested on, a some browsers it failed. My colleague Arthur discovered it had something to do with the language setting of the browser. When we used Dutch (nl-NL) as preferred language the standard core search results web part didn’t return any items when using a query with a “/” in the conditions.</p>
<p>If you execute a KeyWordQuery or FullTextSqlQuery in your own code you have the possibility to specify a culture to use in the search. Unfortunately the core search results web part doesn’t provide you with an option to do this easily. In the end I came up with a “hack” to make this work. Just change the preferred languages the browser sends with each request in the OnInit of a webpart that inherits from the standards core results web part like so:</p>
<pre class="brush: csharp">
protected override void OnInit(EventArgs e)
{
	if (!string.IsNullOrEmpty(CultureOverrideTo))
	{
		if (this.Page.Request.UserLanguages.Length &gt; 0)
			this.Page.Request.UserLanguages[0] = “en-US”;
	}

	base.OnInit(e);
}
</pre>
<p>Note: Because this modifies the current request this can have some consequences on other web parts on your page. So use it with care.</p>
<p>UPDATE:</p>
<p>This same behavior can also occur in custom search code. To fix this, simply specify the Culture of your KeyWordQuery or FullTextSqlQuery.</p>
<!-- RO Social Bookmarks BEGIN --><div class="social_bookmark"><em>Bookmark to:</em><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/" title="Add 'MOSS Search and browser languages' to Twitter"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/twitter.png" title="Add 'MOSS Search and browser languages' to Twitter" alt="Add 'MOSS Search and browser languages' to Twitter" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.myspace.com/Modules/PostTo/Pages/?t=MOSS+Search+and+browser+languages&#038;c=http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/" title="Add 'MOSS Search and browser languages' to MySpace"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/myspace.png" title="Add 'MOSS Search and browser languages' to MySpace" alt="Add 'MOSS Search and browser languages' to MySpace" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/&#038;title=MOSS+Search+and+browser+languages" title="Add 'MOSS Search and browser languages' to Del.icio.us"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/delicious.png" title="Add 'MOSS Search and browser languages' to Del.icio.us" alt="Add 'MOSS Search and browser languages' to Del.icio.us" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&#038;url=http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/&#038;title=MOSS+Search+and+browser+languages" title="Add 'MOSS Search and browser languages' to digg"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/digg.png" title="Add 'MOSS Search and browser languages' to digg" alt="Add 'MOSS Search and browser languages' to digg" /></a><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/&#038;t=MOSS+Search+and+browser+languages" title="Add 'MOSS Search and browser languages' to FaceBook"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/facebook.png" title="Add 'MOSS Search and browser languages' to FaceBook" alt="Add 'MOSS Search and browser languages' to FaceBook" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/" title="Add 'MOSS Search and browser languages' to Technorati"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/technorati.png" title="Add 'MOSS Search and browser languages' to Technorati" alt="Add 'MOSS Search and browser languages' to Technorati" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/&#038;title=MOSS+Search+and+browser+languages" title="Add 'MOSS Search and browser languages' to Stumble Upon"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/stumbleupon.png" title="Add 'MOSS Search and browser languages' to Stumble Upon" alt="Add 'MOSS Search and browser languages' to Stumble Upon" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&#038;output=popup&#038;bkmk=http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/&#038;title=MOSS+Search+and+browser+languages" title="Add 'MOSS Search and browser languages' to Google Bookmarks"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/google.png" title="Add 'MOSS Search and browser languages' to Google Bookmarks" alt="Add 'MOSS Search and browser languages' to Google Bookmarks" /></a></div>
<!-- RO Social Bookmarks END --><p><a  href="http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/">MOSS Search and browser languages</a> is a post from: <a  href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
<div class="fblike" style="height:25px; height:25px; overflow:hidden;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.petergerritsen.nl%2F2009%2F02%2F26%2Fmoss-search-and-browser-languages%2F&amp;layout=standard&amp;show_faces=false&amp;width=320&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allow Transparency="true" style="border:none; overflow:hidden; width:320px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://blog.petergerritsen.nl/2009/02/26/moss-search-and-browser-languages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding AJAX.Net to your MOSS WebParts</title>
		<link>http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss</link>
		<comments>http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 12:53:37 +0000</pubDate>
		<dc:creator>Peter Gerritsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[MOSS]]></category>

		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/</guid>
		<description><![CDATA[I know there are loads of posts on this subject already, but in this one I’ll try to give some useful tips on this subject. First, you need to add AJAX.Net entries to your web.config of the MOSS site. A very easy way to do this is by using the Ajaxify stsadm extensions. Simply add the included [...]<p><a href="http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/">Adding AJAX.Net to your MOSS WebParts</a> is a post from: <a href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I know there are loads of posts on this subject already, but in this one I’ll try to give some useful tips on this subject.</p>
<p>First, you need to add AJAX.Net entries to your web.config of the MOSS site. A very easy way to do this is by using the <a  href="http://www.codeplex.com/ajaxifymoss" target="_blank">Ajaxify</a> <a  href="http://www.codeplex.com/ajaxifymoss" target="_blank">stsadm extensions</a>.</p>
<p>Simply add the included wsp to your solutions and deploy. After that you can easily add the entries by running the <em>stsadm –addajaxmoss</em> command. Unfortunately you need to add one entry manually, but that is given as part of the output when you run the command.</p>
<p>Next you need to add a ScriptManager to the pages with the AJAX enabled webparts. You can off course modify the masterpage. I chose to create a base web part that checks if a ScriptManager has been added to the page and adds it if necessary:</p>
<pre class="brush: csharp">
protected override void OnInit(EventArgs e)
{
base.OnInit(e);

//Register the ScriptManager

ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);

if (scriptManager == null)
{
scriptManager = new ScriptManager();
scriptManager.ID = “ScriptManager1″;

scriptManager.EnablePartialRendering = true;

this.Page.Form.Controls.AddAt(0, scriptManager);
}
}
</pre>
<p>Because MOSS needs a lot of JavaScript to function properly, this unfortunately requires another fix. You can read more about it <a  href="http://msdn.microsoft.com/en-us/library/bb861877.aspx" target="_blank">here</a>. I added the fix to the base webpart with the following code:</p>
<pre class="brush: csharp">
protected override void CreateChildControls()
{
//Add fix according to http://msdn2.microsoft.com/en-us/library/bb861877.aspx

EnsurePanelFix();
}

private void EnsurePanelFix()
{
if (this.Page.Form!= null)
{
String fixupScript = @”
_spBodyOnLoadFunctionNames.push(“”_initFormActionAjax”&quot;);
function _initFormActionAjax()
{
if (_spEscapedFormAction == document.forms[0].action)
{
document.forms[0]._initialAction = document.forms[0].action;
}
}

var RestoreToOriginalFormActionCore = RestoreToOriginalFormAction;
RestoreToOriginalFormAction = function()
{
if (_spOriginalFormAction != null)
{
RestoreToOriginalFormActionCore();
document.forms[0]._initialAction = document.forms[0].action;
}
}”;

ScriptManager.RegisterStartupScript(this, typeof(BaseWebPart), “UpdatePanelFixup”, fixupScript, true);
}
}
</pre>
<p>Because all the content you want to include in an UpdatePanel needs to be added to the ControlTemplateContainer.Controls collection, it’s not possible to write out any html you need between controls in the UpdatePanel by using the standard HtmlTextWriter.WriteLine method in the Render method. The easiest way is to add LiteralControls to the controlcollection of the UpdatePanel (with thanks to my collegue Wouter Lemaire for giving me the tip). To make this even easier, I’ve added the following extension method to my project:</p>
<pre class="brush: csharp">
public static void AddLiteral(this UpdatePanel updatePanel, string html)
{
Literal lit = new Literal();
lit.Text = html + “\r\n”;
updatePanel.ContentTemplateContainer.Controls.Add(lit);
}
</pre>
<p>You can call this method from the CreateChildControls method in your web part like so:</p>
<pre class="brush: csharp">
updatePanel.AddLiteral(“&lt;table&gt;&lt;tr&gt;”);
updatePanel.AddLiteral(“&lt;td&gt;&lt;/td&gt;&lt;td&gt;Ma&lt;/td&gt;&lt;td&gt;Di&lt;/td&gt;&lt;td&gt;Wo&lt;/td&gt;&lt;td&gt;Do&lt;/td&gt;&lt;td&gt;Vr&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;”);
updatePanel.AddLiteral(“&lt;td&gt;Ochtend&lt;/td&gt;&lt;td&gt;”);
</pre>
<p>To indicate progress you need some form of visual feedback to the user. For this you need to set the ProgressTemplate of the UpdatePanel. For this you need to create a class that implements the ITemplate interface.</p>
<p>Then you implement the InstantiateIn method to create a template:</p>
<pre class="brush: csharp">
public void ITemplate.InstantiateIn(Control container)
{
Label lbl = new Label();
lbl.Text = “Progress….”;
container.Controls.Add(lbl);
}
</pre>
<p>Then add an object of this class to the ProgressTemplate property of the UpdatePanel:</p>
<pre class="brush: csharp">
updateProgress.ProgressTemplate = new ProgressTemplate();
</pre>
<!-- RO Social Bookmarks BEGIN --><div class="social_bookmark"><em>Bookmark to:</em><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/" title="Add 'Adding AJAX.Net to your MOSS WebParts' to Twitter"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/twitter.png" title="Add 'Adding AJAX.Net to your MOSS WebParts' to Twitter" alt="Add 'Adding AJAX.Net to your MOSS WebParts' to Twitter" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.myspace.com/Modules/PostTo/Pages/?t=Adding+AJAX.Net+to+your+MOSS+WebParts&#038;c=http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/" title="Add 'Adding AJAX.Net to your MOSS WebParts' to MySpace"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/myspace.png" title="Add 'Adding AJAX.Net to your MOSS WebParts' to MySpace" alt="Add 'Adding AJAX.Net to your MOSS WebParts' to MySpace" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/&#038;title=Adding+AJAX.Net+to+your+MOSS+WebParts" title="Add 'Adding AJAX.Net to your MOSS WebParts' to Del.icio.us"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/delicious.png" title="Add 'Adding AJAX.Net to your MOSS WebParts' to Del.icio.us" alt="Add 'Adding AJAX.Net to your MOSS WebParts' to Del.icio.us" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&#038;url=http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/&#038;title=Adding+AJAX.Net+to+your+MOSS+WebParts" title="Add 'Adding AJAX.Net to your MOSS WebParts' to digg"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/digg.png" title="Add 'Adding AJAX.Net to your MOSS WebParts' to digg" alt="Add 'Adding AJAX.Net to your MOSS WebParts' to digg" /></a><br /><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/&#038;t=Adding+AJAX.Net+to+your+MOSS+WebParts" title="Add 'Adding AJAX.Net to your MOSS WebParts' to FaceBook"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/facebook.png" title="Add 'Adding AJAX.Net to your MOSS WebParts' to FaceBook" alt="Add 'Adding AJAX.Net to your MOSS WebParts' to FaceBook" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/" title="Add 'Adding AJAX.Net to your MOSS WebParts' to Technorati"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/technorati.png" title="Add 'Adding AJAX.Net to your MOSS WebParts' to Technorati" alt="Add 'Adding AJAX.Net to your MOSS WebParts' to Technorati" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/&#038;title=Adding+AJAX.Net+to+your+MOSS+WebParts" title="Add 'Adding AJAX.Net to your MOSS WebParts' to Stumble Upon"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/stumbleupon.png" title="Add 'Adding AJAX.Net to your MOSS WebParts' to Stumble Upon" alt="Add 'Adding AJAX.Net to your MOSS WebParts' to Stumble Upon" /></a><a  class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&#038;output=popup&#038;bkmk=http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/&#038;title=Adding+AJAX.Net+to+your+MOSS+WebParts" title="Add 'Adding AJAX.Net to your MOSS WebParts' to Google Bookmarks"><img src="http://blog.petergerritsen.nl/wp-content/plugins/ro-social-bookmarks/google.png" title="Add 'Adding AJAX.Net to your MOSS WebParts' to Google Bookmarks" alt="Add 'Adding AJAX.Net to your MOSS WebParts' to Google Bookmarks" /></a></div>
<!-- RO Social Bookmarks END --><p><a  href="http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/">Adding AJAX.Net to your MOSS WebParts</a> is a post from: <a  href="http://blog.petergerritsen.nl">Peter Gerritsen&#039;s blog</a></p>
<div class="fblike" style="height:25px; height:25px; overflow:hidden;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.petergerritsen.nl%2F2009%2F02%2F18%2Fadding-ajax-net-to-your-moss-webparts%2F&amp;layout=standard&amp;show_faces=false&amp;width=320&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allow Transparency="true" style="border:none; overflow:hidden; width:320px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://blog.petergerritsen.nl/2009/02/18/adding-ajax-net-to-your-moss-webparts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
