<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9155497887072087397</id><updated>2024-09-17T00:04:03.508-04:00</updated><category term="microsoft"/><category term="visual studio 2008"/><category term="sharepoint"/><category term=".net 3.5"/><category term="2007"/><category term="ajax"/><category term="asp.net"/><category term="c#"/><category term="office"/><category term="openxml sdk 2.0"/><category term="word"/><category term=".docx"/><category term=".net"/><category term="atlas"/><category term="authenticationservice"/><category term="css"/><category term="docx"/><category term="drag"/><category term="drop"/><category term="drop-down"/><category term="encryption"/><category term="futures"/><category term="https"/><category term="menu"/><category term="moss"/><category term="navigation"/><category term="net 3.5"/><category term="os"/><category term="server"/><category term="vista"/><category term="visual studio 2005"/><category term="wss"/><category term="xml"/><category term="xp"/><title type='text'>Caught in the .Net</title><subtitle type='html'>Tips, tricks, and knowledge sharing about Microsoft .NET technologies, including .NET Framework 2.0, 3.5, AJAX, ASP.NET, C#, Visual Studio 2008, and Sharepoint (WSS | MOSS)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://caughtinthedotnet.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://caughtinthedotnet.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Max</name><uri>http://www.blogger.com/profile/01877683089903862092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgFa4O9ERBFcGzuLlDnnAh9DErCYxCYvquaCXS3rWjtp7m3awM9Hzvr04UTJY2dv0jGSvv-1X2U57AH2zYuDARdLspERgCNfNNFSAQLfFeCRTq88yfLu7e8nhNcdVrFeE/s220/maxwb3.th.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9155497887072087397.post-6316761060292280166</id><published>2011-01-21T23:52:00.003-05:00</published><updated>2011-01-21T23:53:27.632-05:00</updated><title type='text'>Blog Moved...</title><content type='html'>... to &lt;a href=&quot;http://blog.image0.com/&quot;&gt;blog.image0.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Please update your bookmarks.</content><link rel='replies' type='application/atom+xml' href='http://caughtinthedotnet.blogspot.com/feeds/6316761060292280166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/9155497887072087397/6316761060292280166' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/6316761060292280166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/6316761060292280166'/><link rel='alternate' type='text/html' href='http://caughtinthedotnet.blogspot.com/2011/01/blog-moved.html' title='Blog Moved...'/><author><name>Max</name><uri>http://www.blogger.com/profile/01877683089903862092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgFa4O9ERBFcGzuLlDnnAh9DErCYxCYvquaCXS3rWjtp7m3awM9Hzvr04UTJY2dv0jGSvv-1X2U57AH2zYuDARdLspERgCNfNNFSAQLfFeCRTq88yfLu7e8nhNcdVrFeE/s220/maxwb3.th.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9155497887072087397.post-5622106248878532883</id><published>2009-07-08T14:18:00.006-04:00</published><updated>2009-07-08T14:45:52.275-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".net 3.5"/><category scheme="http://www.blogger.com/atom/ns#" term="2007"/><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="docx"/><category scheme="http://www.blogger.com/atom/ns#" term="microsoft"/><category scheme="http://www.blogger.com/atom/ns#" term="office"/><category scheme="http://www.blogger.com/atom/ns#" term="openxml sdk 2.0"/><category scheme="http://www.blogger.com/atom/ns#" term="sharepoint"/><category scheme="http://www.blogger.com/atom/ns#" term="visual studio 2008"/><category scheme="http://www.blogger.com/atom/ns#" term="word"/><title type='text'>How to get around OpenXML error: Can not replace the OpenXmlElement &quot;newChild&quot; because it is part of a tree</title><content type='html'>I was recently working on a MS Word doc generation project and kept getting this error.&lt;br /&gt;&lt;br /&gt;It took me a while to figure out the source of the problem, but it made total sense...&lt;br /&gt;When you are a building a document tree (example below), you are creating new elements like&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;csharpcode&quot;&gt;&lt;br /&gt;&lt;pre class=&quot;alt&quot;&gt;var myRun = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Run(&lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Text(&lt;span class=&quot;str&quot;&gt;&quot;reusable text&quot;&lt;/span&gt;));&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;var myParagraph = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Paragraph();&lt;/pre&gt;&lt;br /&gt;&lt;pre class=&quot;alt&quot;&gt;myParagraph.AppendChild(myRun);&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The 3rd line above ties in that Run object into the Paragraph object, so if you try to reuse the myRun object by appending it somewhere else - you will get this error.&lt;br /&gt;&lt;br /&gt;I also tried creating a new Run() object using the old one as the object initializer:&lt;br /&gt;&lt;div class=&quot;csharpcode&quot;&gt;&lt;br /&gt;&lt;pre class=&quot;alt&quot;&gt;var myRun2 = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Run(myRun);&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;That will throw the same error.&lt;br /&gt;Why? Because the above line copies instantiates myRun2 with the reference of the myRun object so when you try to Append it elsewhere, you will get the error because it&#39;s technically the same object.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Workaround&lt;/span&gt;&lt;br /&gt;There is a very handy property that most OpenXML elements have - OuterXml.   The other handy thing about it - it&#39;s in most class constructors so it can be used to instantiate an object.&lt;br /&gt;In lamens terms, instead of&lt;br /&gt;&lt;div class=&quot;csharpcode&quot;&gt;&lt;br /&gt;&lt;pre class=&quot;alt&quot;&gt;var myRun2 = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Run(myRun);&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;try&lt;br /&gt;&lt;div class=&quot;csharpcode&quot;&gt;&lt;br /&gt;&lt;pre class=&quot;alt&quot;&gt;var myRun2 = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Run(myRun.OuterXml);&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Sample tree:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;SdtBlock&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;- Paragraph&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;    ----Run &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;------Text&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;----Run&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;------Break&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;----Run&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;------Text&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://caughtinthedotnet.blogspot.com/feeds/5622106248878532883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/9155497887072087397/5622106248878532883' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/5622106248878532883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/5622106248878532883'/><link rel='alternate' type='text/html' href='http://caughtinthedotnet.blogspot.com/2009/07/how-to-get-around-openxml-error-can-not.html' title='How to get around OpenXML error: Can not replace the OpenXmlElement &quot;newChild&quot; because it is part of a tree'/><author><name>Max</name><uri>http://www.blogger.com/profile/01877683089903862092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgFa4O9ERBFcGzuLlDnnAh9DErCYxCYvquaCXS3rWjtp7m3awM9Hzvr04UTJY2dv0jGSvv-1X2U57AH2zYuDARdLspERgCNfNNFSAQLfFeCRTq88yfLu7e8nhNcdVrFeE/s220/maxwb3.th.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9155497887072087397.post-1105466808218123067</id><published>2009-06-01T10:44:00.002-04:00</published><updated>2009-06-01T10:46:31.752-04:00</updated><title type='text'>10 Best Practices For Building SharePoint Solutions</title><content type='html'>Came across an excellent article in MSDN Magazine:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/dd458798.aspx&quot;&gt;10 Best Practices For Building SharePoint Solutions&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It&#39;s a must read if you are looking to deploy custom Sharepoint applications into your farm.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://caughtinthedotnet.blogspot.com/feeds/1105466808218123067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/9155497887072087397/1105466808218123067' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/1105466808218123067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/1105466808218123067'/><link rel='alternate' type='text/html' href='http://caughtinthedotnet.blogspot.com/2009/06/10-best-practices-for-building.html' title='10 Best Practices For Building SharePoint Solutions'/><author><name>Max</name><uri>http://www.blogger.com/profile/01877683089903862092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgFa4O9ERBFcGzuLlDnnAh9DErCYxCYvquaCXS3rWjtp7m3awM9Hzvr04UTJY2dv0jGSvv-1X2U57AH2zYuDARdLspERgCNfNNFSAQLfFeCRTq88yfLu7e8nhNcdVrFeE/s220/maxwb3.th.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9155497887072087397.post-4973502490882677548</id><published>2009-03-18T16:13:00.002-04:00</published><updated>2009-03-18T20:07:34.766-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="microsoft"/><category scheme="http://www.blogger.com/atom/ns#" term="moss"/><category scheme="http://www.blogger.com/atom/ns#" term="sharepoint"/><category scheme="http://www.blogger.com/atom/ns#" term="wss"/><title type='text'>Sharepoint</title><content type='html'>I have added Sharepoint as an additional topic that I will blog about.  &lt;br /&gt;&lt;br /&gt;I have been doing a lot more Sharepoint development and integration at work, and it&#39;s actually sparking an interest.&lt;br /&gt;&lt;br /&gt;So, stay tuned.</content><link rel='replies' type='application/atom+xml' href='http://caughtinthedotnet.blogspot.com/feeds/4973502490882677548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/9155497887072087397/4973502490882677548' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/4973502490882677548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/4973502490882677548'/><link rel='alternate' type='text/html' href='http://caughtinthedotnet.blogspot.com/2009/03/sharepoint.html' title='Sharepoint'/><author><name>Max</name><uri>http://www.blogger.com/profile/01877683089903862092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgFa4O9ERBFcGzuLlDnnAh9DErCYxCYvquaCXS3rWjtp7m3awM9Hzvr04UTJY2dv0jGSvv-1X2U57AH2zYuDARdLspERgCNfNNFSAQLfFeCRTq88yfLu7e8nhNcdVrFeE/s220/maxwb3.th.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9155497887072087397.post-479223545147663852</id><published>2009-02-22T10:31:00.011-05:00</published><updated>2009-02-22T13:02:18.395-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".docx"/><category scheme="http://www.blogger.com/atom/ns#" term=".net 3.5"/><category scheme="http://www.blogger.com/atom/ns#" term="2007"/><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="microsoft"/><category scheme="http://www.blogger.com/atom/ns#" term="office"/><category scheme="http://www.blogger.com/atom/ns#" term="openxml sdk 2.0"/><category scheme="http://www.blogger.com/atom/ns#" term="sharepoint"/><category scheme="http://www.blogger.com/atom/ns#" term="visual studio 2008"/><category scheme="http://www.blogger.com/atom/ns#" term="word"/><title type='text'>OpenXML &amp; Word Doc Manipulation using Sharepoint Data</title><content type='html'>Call me a lousy blogger but there is no whatisluxury.com code in this post because I&#39;ve been busy refactoring it.  That&#39;s not the only reason.  I have been involved in a lot more Sharepoint development at work lately - moreso than .Net, so I&#39;ve been kind of busy reading up SDKs and playing with APIs.&lt;br /&gt;&lt;br /&gt;On that note,  I got a chance to get my hands dirty with some OpenXML 2.0.  The cool thing about that was that it was @ Microsoft.  Not only did I get to play with it, but met the guys that developed parts of it and even wrote 2,000 of the 6,000 pages of documentation - Tristan Davis and Zeyad  Rajabi - who helped me a great deal.&lt;br /&gt;&lt;br /&gt;The story that I worked on involved gathering data from Sharepoint lists (some of it fed from the BDC(business data catalog)) and using OpenXML to populate a Word template.  The real world scenario behind it is at my company, like I&#39;m sure at a lot of other companies, we have administrative assistants who end up generating the documents for meetings.  They just sit there copying and pasting data from various data sources and reports into this document.  And there are as many documents generated as there are assistants multiplied by weeks in the year.   Seriously - these people end up working 60 hour workweeks.&lt;br /&gt;&lt;br /&gt;The program utilizing OpenXML to generate these documents for them is actually pretty simple.  I had some issues deploying it as a web app onto Sharepoint because of various little issues that arose along the way (running sharepoint on a 64-bit windows 2008 server w/ IIS 7 - some assemblies were 32-bit, so couldn&#39;t get it to run; other times, there were IIS7 issues.  Note to self: improve knowledge of IIS7).  Because of that, I wrote it as a WinForms app.&lt;br /&gt;&lt;br /&gt;The interface is pretty boring - it has 2 listboxes.&lt;br /&gt;The first listbox contains key data - in this case, a list of product names.  This field is used as a foreign key to relate it to a bunch of other lists - sales data list, product manager list, and even a Sharepoint picture library.&lt;br /&gt;The second listbox contains a list of template documents from a document library that was created.&lt;br /&gt;There is also a textbox for indicating what the new filename is going to be once the document is generated, and a button that generates the document.&lt;br /&gt;&lt;br /&gt;So how does this all work?&lt;br /&gt;First of all, none of this would be possible if Microsoft hadn&#39;t created the new .docx, .xlsx, .pptx formats in Office 2007.  As much as I cursed it for doing so - I have seen the light last week.  The new format is purely XML based.  Hence, OpenXML allows us to manipulate the hell out of our documents without ever opening up Microsoft Word.&lt;br /&gt;&lt;br /&gt;The one caveat is that Microsoft Word&#39;s Markup Language (WordML) is a bit cumbersome to learn right off the bat.  The good news is that with a bit of blog reading from Brian Jones on &lt;a href=&quot;http://blogs.msdn.com/brian_jones/archive/2008/10/06/open-xml-format-sdk-2-0.aspx&quot;&gt;OpenXML&lt;/a&gt; and an &lt;span style=&quot;font-weight: bold;&quot;&gt;extremely&lt;/span&gt; powerful tool that comes with the SDK called DocumentReflector, you will be generating documents in no time. Here is a video by Alistair Spears that gives a demo of this wonderful tool: [&lt;a href=&quot;http://video.msn.com/video.aspx/?vid=d50a0a13-836b-4849-9bbc-4c9134a63754&amp;amp;ifs=true&amp;amp;fr=msnvideo&amp;amp;mkt=en-US&amp;amp;from=writer&quot;&gt;http://video.msn.com/video.aspx/?vid=d50a0a13-836b-4849-9bbc-4c9134a63754&amp;amp;ifs=true&amp;amp;fr=msnvideo&amp;amp;mkt=en-US&amp;amp;from=writer&lt;/a&gt;]&lt;br /&gt;&lt;br /&gt;So, how did I get data in from sharepoint lists into a word document? Let&#39;s take a look at the process step-by-step.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(51, 102, 255);&quot;&gt;Traversing Sharepoint Lists/Doc Libraries/Picture Libraries&lt;/span&gt;&lt;br /&gt;1. The first thing you will need is to connect to a sharepoint list.  The code is the easy part - it&#39;s just 2 lines:&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal;font-family:Consolas;font-size:12;&quot;  &gt;&lt;pre class=&quot;alt&quot;   style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); white-space: normal;&quot;&gt;&lt;pre class=&quot;alt&quot;   style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;&lt;span class=&quot;rem&quot; style=&quot;color: rgb(0, 128, 0);&quot;&gt;//declarations&lt;/span&gt;&lt;/pre&gt;&lt;pre   style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;&lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;protected&lt;/span&gt; SPListItemCollection product_owner_items;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;   style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;&lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;protected&lt;/span&gt; SPListItemCollection template_doc_items;&lt;/pre&gt;&lt;pre   style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;&lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;protected&lt;/span&gt; SPListItemCollection marketing_info_items;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;   style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;&lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;protected&lt;/span&gt; SPPictureLibrary product_model_pics;&lt;/pre&gt;&lt;pre   style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;&lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;protected&lt;/span&gt; SPSite mysite;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;   style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;&lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;protected&lt;/span&gt; SPWeb myweb;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal;font-family:Consolas;font-size:12;&quot;  &gt;&lt;pre class=&quot;alt&quot;   style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;mysite = &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;new&lt;/span&gt; SPSite(&lt;span class=&quot;str&quot; style=&quot;color: rgb(0, 96, 128);&quot;&gt;&quot;http://izmqdp6452022/Docs/Lists/Product%20Owners/AllItems.aspx&quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre   style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;myweb = mysite.AllWebs[&lt;span class=&quot;str&quot; style=&quot;color: rgb(0, 96, 128);&quot;&gt;&quot;Docs&quot;&lt;/span&gt;];&lt;/pre&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;SPSite&#39;s constructor can actually determine what site you are connecting to in your Sharepoint farm based on the URL passed in.  You just have to make sure that whichever user your app is running as, must have access to these libraries and to the Sharepoint site.&lt;br /&gt;&lt;br /&gt;Here is the code used to get my Sharepoint list objects ready for access:&lt;br /&gt;&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal;font-family:Consolas;font-size:12;&quot;  &gt;&lt;pre class=&quot;alt&quot;   style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;&lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;void&lt;/span&gt; initialize_sharepoint_lists()&lt;/pre&gt;&lt;pre   style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;{&lt;/pre&gt;&lt;pre class=&quot;alt&quot;   style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;  product_owner_items = mysite.AllWebs[&lt;span class=&quot;str&quot; style=&quot;color: rgb(0, 96, 128);&quot;&gt;&quot;Docs&quot;&lt;/span&gt;].Lists[&lt;span class=&quot;str&quot; style=&quot;color: rgb(0, 96, 128);&quot;&gt;&quot;Product Owners&quot;&lt;/span&gt;].Items;&lt;/pre&gt;&lt;pre   style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;  marketing_info_items = mysite.AllWebs[&lt;span class=&quot;str&quot; style=&quot;color: rgb(0, 96, 128);&quot;&gt;&quot;Docs&quot;&lt;/span&gt;].Lists[&lt;span class=&quot;str&quot; style=&quot;color: rgb(0, 96, 128);&quot;&gt;&quot;Marketing Info List&quot;&lt;/span&gt;].Items;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;   style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;  template_doc_items = mysite.AllWebs[&lt;span class=&quot;str&quot; style=&quot;color: rgb(0, 96, 128);&quot;&gt;&quot;Docs&quot;&lt;/span&gt;].Lists[&lt;span class=&quot;str&quot; style=&quot;color: rgb(0, 96, 128);&quot;&gt;&quot;Documents&quot;&lt;/span&gt;].Items;&lt;/pre&gt;&lt;pre face=&quot;Consolas,&#39;Courier New&#39;,Courier,monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);&quot;&gt;  product_model_pics = (SPPictureLibrary)mysite.AllWebs[&lt;span class=&quot;str&quot; style=&quot;color: rgb(0, 96, 128);&quot;&gt;&quot;Docs&quot;&lt;/span&gt;].Lists[&lt;span class=&quot;str&quot; style=&quot;color: rgb(0, 96, 128);&quot;&gt;&quot;Product Model Images&quot;&lt;/span&gt;];&lt;/pre&gt;&lt;pre class=&quot;alt&quot;   style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;font-family:Consolas,&#39;Courier New&#39;,Courier,monospace;font-size:small;&quot;&gt;}&lt;/pre&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;In this case, &quot;Docs&quot; is the name of the sharepoint site and the Lists indexers contain the names of the libraries that I am working with in sharepoint.&lt;br /&gt;&lt;br /&gt;Once I have the data I need to be inserted into the Word document, I need to create a template in Microsoft Word.  This is the easiest part of the operation.  You simply open up Microsoft Word, enable the Developer toolbar by right-clicking on the ribbon and insert a text-box field wherever you will have data inserted.  Make sure you assign an alias to the text-box - this is how you will access your placeholder for insertion.&lt;br /&gt;&lt;br /&gt;Before attempting this exercise, you should find a sample Word 2007 document and open it in DocumentReflector so that you can get an idea of how the XML is formatted because the code below can get confusing REAL quickly if you don&#39;t.&lt;br /&gt;&lt;br /&gt;The fields that you created using the developer tab can be accessed one of two ways.  If the field is on a new line, it will live in a &lt;&lt;span style=&quot;font-family:courier new;&quot;&gt;SdtContentBlock&lt;/span&gt;&gt; element.  If the field is on the same line as some text, say, a label, it will live in a &lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;sdtrun&gt;&lt;/sdtrun&gt;&lt;/span&gt; element.  Now, the trick is to locate these elements and pass the data into them.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is the method that will take a string, the alias of the field you are manipulating, and a WordProcessingDocument object which contains the open word document.  This method will modify a SdtRun block - the element that lives on the same line as other text:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;;font-family:Consolas;font-size:12;&quot;  &gt;&lt;pre class=&quot;alt&quot; style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; font-size: small;&quot;&gt;&lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;void&lt;/span&gt; populate_run_control(WordprocessingDocument wordDoc,&lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;string&lt;/span&gt; alias, &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;value&lt;/span&gt;)&lt;/pre&gt;&lt;pre face=&quot;Consolas,&#39;Courier New&#39;,Courier,monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);&quot;&gt;        {&lt;/pre&gt;&lt;pre class=&quot;alt&quot; style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; font-size: small;&quot;&gt;            var contentControls = wordDoc.MainDocumentPart&lt;/pre&gt;&lt;pre face=&quot;Consolas,&#39;Courier New&#39;,Courier,monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);&quot;&gt;                            .Document&lt;/pre&gt;&lt;pre class=&quot;alt&quot; style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; font-size: small;&quot;&gt;                            .Descendants&lt;sdtrun&gt;()&lt;/sdtrun&gt;&lt;/pre&gt;&lt;pre style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255); font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; font-size: small;&quot;&gt;                            .Where(s =&gt; s.SdtProperties.GetFirstChild&lt;alias&gt;().Val.Value == alias);&lt;/alias&gt;&lt;/pre&gt;&lt;pre class=&quot;alt&quot; style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; font-size: small;&quot;&gt; &lt;/pre&gt;&lt;pre style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255); font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; font-size: small;&quot;&gt;            &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;if&lt;/span&gt; (contentControls.Count() != 0)&lt;/pre&gt;&lt;pre class=&quot;alt&quot;   style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;font-family:Consolas, &#39;Courier New&#39;, Courier, monospace;font-size:small;&quot;&gt;            {&lt;/pre&gt;&lt;pre style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255); font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; font-size: small;&quot;&gt;                var sdt = &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;new&lt;/span&gt; SdtContentRun(&lt;/pre&gt;&lt;pre class=&quot;alt&quot;   style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;font-family:Consolas, &#39;Courier New&#39;, Courier, monospace;font-size:small;&quot;&gt;                           &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;new&lt;/span&gt; Run(&lt;/pre&gt;&lt;pre style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255); font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; font-size: small;&quot;&gt;                                &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;new&lt;/span&gt; RunProperties(&lt;/pre&gt;&lt;pre class=&quot;alt&quot; face=&quot;Consolas, &#39;Courier New&#39;, Courier, monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt;                                    &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;new&lt;/span&gt; RunStyleId() { Val = &lt;span class=&quot;str&quot; style=&quot;color: rgb(0, 96, 128);&quot;&gt;&quot;PlaceholderText&quot;&lt;/span&gt; }),&lt;/pre&gt;&lt;pre   style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);font-family:Consolas, &#39;Courier New&#39;, Courier, monospace;font-size:small;&quot;&gt;                                &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;new&lt;/span&gt; Text(&lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;value&lt;/span&gt;)));&lt;/pre&gt;&lt;pre class=&quot;alt&quot; face=&quot;Consolas, &#39;Courier New&#39;, Courier, monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt; &lt;/pre&gt;&lt;pre face=&quot;Consolas, &#39;Courier New&#39;, Courier, monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);&quot;&gt;                contentControls.First().SdtContentRun.RemoveAllChildren();&lt;/pre&gt;&lt;pre class=&quot;alt&quot; face=&quot;Consolas, &#39;Courier New&#39;, Courier, monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt;                contentControls.First().SdtContentRun.InsertAt(sdt, 0);&lt;/pre&gt;&lt;pre face=&quot;Consolas, &#39;Courier New&#39;, Courier, monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);&quot;&gt; &lt;/pre&gt;&lt;pre class=&quot;alt&quot; face=&quot;Consolas, &#39;Courier New&#39;, Courier, monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt;            } &lt;/pre&gt;&lt;pre face=&quot;Consolas, &#39;Courier New&#39;, Courier, monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);&quot;&gt;        }&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The method below has the same task in mind, but modifies an SdtContentBlock element that starts on a new line.  Another difference is that it takes in an html Table object, which can be easily formed just like you are used to in ASP.Net/C# - Table, TableRow [tr], TableCell, etc. This could be as simplistic or as complex as you want.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;;font-family:Consolas;font-size:12;&quot;  &gt;&lt;pre class=&quot;alt&quot; face=&quot;Consolas,&#39;Courier New&#39;,Courier,monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt;&lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;        private&lt;/span&gt; &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;void&lt;/span&gt; populate_block_table(WordprocessingDocument wordDoc, &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;string&lt;/span&gt; alias, Table &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;value&lt;/span&gt;)&lt;/pre&gt;&lt;pre face=&quot;Consolas, &#39;Courier New&#39;, Courier, monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);&quot;&gt;        {&lt;/pre&gt;&lt;pre class=&quot;alt&quot; face=&quot;Consolas,&#39;Courier New&#39;,Courier,monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt;            var contentControls = wordDoc.MainDocumentPart&lt;/pre&gt;&lt;pre face=&quot;Consolas,&#39;Courier New&#39;,Courier,monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);&quot;&gt;                            .Document&lt;/pre&gt;&lt;pre class=&quot;alt&quot; style=&quot;margin: 0em; font-size: small; color: black; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt;                            .Descendants&lt;sdtblock&gt;()&lt;/sdtblock&gt;&lt;/pre&gt;&lt;pre face=&quot;Consolas,&#39;Courier New&#39;,Courier,monospace&quot; size=&quot;small&quot; style=&quot;margin: 0em; color: black; background-color: rgb(255, 255, 255);&quot;&gt;                            .Where(s =&gt; s.SdtProperties.GetFirstChild&lt;alias&gt;().Val.Value == alias);&lt;/alias&gt;&lt;/pre&gt;&lt;pre class=&quot;alt&quot; style=&quot;margin: 0em; font-size: small; color: black; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt; &lt;/pre&gt;&lt;pre style=&quot;margin: 0em; font-size: small; color: black; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; background-color: rgb(255, 255, 255);&quot;&gt;            &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;if&lt;/span&gt; (contentControls.Count() != 0)&lt;/pre&gt;&lt;pre class=&quot;alt&quot; style=&quot;margin: 0em; font-size: small; color: black; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt;            {&lt;/pre&gt;&lt;pre style=&quot;margin: 0em; font-size: small; color: black; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; background-color: rgb(255, 255, 255);&quot;&gt;                var sdt = &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;new&lt;/span&gt; SdtContentBlock(&lt;/pre&gt;&lt;pre class=&quot;alt&quot; style=&quot;margin: 0em; font-size: small; color: black; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt;                           &lt;span class=&quot;kwrd&quot; style=&quot;color: rgb(0, 0, 255);&quot;&gt;value&lt;/span&gt;);&lt;/pre&gt;&lt;pre style=&quot;margin: 0em; font-size: small; color: black; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; background-color: rgb(255, 255, 255);&quot;&gt; &lt;/pre&gt;&lt;pre class=&quot;alt&quot; style=&quot;margin: 0em; font-size: small; color: black; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt;                contentControls.First().SdtContentBlock.RemoveAllChildren();&lt;/pre&gt;&lt;pre style=&quot;margin: 0em; font-size: small; color: black; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; background-color: rgb(255, 255, 255);&quot;&gt;                contentControls.First().SdtContentBlock.InsertAt(sdt, 0);&lt;/pre&gt;&lt;pre class=&quot;alt&quot; style=&quot;margin: 0em; font-size: small; color: black; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt; &lt;/pre&gt;&lt;pre style=&quot;margin: 0em; font-size: small; color: black; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; background-color: rgb(255, 255, 255);&quot;&gt;            }&lt;/pre&gt;&lt;pre class=&quot;alt&quot; style=&quot;margin: 0em; font-size: small; color: black; font-family: Consolas,&#39;Courier New&#39;,Courier,monospace; background-color: rgb(244, 244, 244); width: 100%;&quot;&gt;        }&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I won&#39;t bore you with the rest of the code used to open files into MemoryStreams or save them, but if you would like to see the inner workings anyway, I recommend taking a look at Brian Jones&#39;s blog post about Office Extensibility: [&lt;a href=&quot;http://blogs.msdn.com/brian_jones/archive/2009/01/19/pushing-data-from-a-database-into-a-word-document.aspx&quot;&gt;http://blogs.msdn.com/brian_jones/archive/2009/01/19/pushing-data-from-a-database-into-a-word-document.aspx&lt;/a&gt;]&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Don&#39;t hesitate to comment and let me know if you have any questions.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://caughtinthedotnet.blogspot.com/feeds/479223545147663852/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/9155497887072087397/479223545147663852' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/479223545147663852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/479223545147663852'/><link rel='alternate' type='text/html' href='http://caughtinthedotnet.blogspot.com/2009/02/openxml-word-doc-manipulation.html' title='OpenXML &amp; Word Doc Manipulation using Sharepoint Data'/><author><name>Max</name><uri>http://www.blogger.com/profile/01877683089903862092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgFa4O9ERBFcGzuLlDnnAh9DErCYxCYvquaCXS3rWjtp7m3awM9Hzvr04UTJY2dv0jGSvv-1X2U57AH2zYuDARdLspERgCNfNNFSAQLfFeCRTq88yfLu7e8nhNcdVrFeE/s220/maxwb3.th.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9155497887072087397.post-3346553802232774806</id><published>2009-01-22T13:10:00.002-05:00</published><updated>2009-01-22T13:25:31.049-05:00</updated><title type='text'>Back from the Dead</title><content type='html'>&lt;span style=&quot;font-family: lucida grande;&quot;&gt;For a blogger, I&#39;ve bit the dust in terms of frequent posts.  However, I would rather post useful stuff once a month (or two) than post anything for the sake of posting.&lt;br /&gt;&lt;br /&gt;Having said that, I know I haven&#39;t posted in a while.  I&#39;ve been occupied with two major projects. &lt;br /&gt;&lt;/span&gt;&lt;ol style=&quot;font-family: lucida grande;&quot;&gt;&lt;li&gt;Nothin But .NET Bootcamp&lt;/li&gt;&lt;li&gt;Whatisluxury.com&lt;/li&gt;&lt;/ol&gt;&lt;span style=&quot;font-family: lucida grande;&quot;&gt;In October 2008, I was given the opportunity to go to J.P Boodhoo&#39;s Nothin But .NET bootcamp (&lt;/span&gt;&lt;a style=&quot;font-family: lucida grande;&quot; href=&quot;http://www.jpboodhoo.com/training.oo&quot;&gt;http://www.jpboodhoo.com/training.oo&lt;/a&gt;&lt;span style=&quot;font-family: lucida grande;&quot;&gt;).  It was a truly humbling experience and gave me a chance to set some goals for myself, in terms of self improvement in the .NET field.  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: lucida grande;&quot;&gt;At the end of December 2008, I launched an online luxury magazine for the publishers of Beverly Hills Report called WhatIsLuxury? (&lt;/span&gt;&lt;a style=&quot;font-family: lucida grande;&quot; href=&quot;http://www.whatisluxury.com&quot;&gt;http://www.whatisluxury.com&lt;/a&gt;&lt;span style=&quot;font-family: lucida grande;&quot;&gt;).  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: lucida grande;&quot;&gt;It was a fun experience and in the coming weeks, I would like to share some of the tricks &amp;amp; techniques I&#39;ve used to accomplish some challenges that their requirements presented, including:&lt;/span&gt;&lt;br /&gt;&lt;ul style=&quot;font-family: lucida grande;&quot;&gt;&lt;li&gt;AJAX-enabled story rotation on the home page&lt;/li&gt;&lt;li&gt;Full Page Ad rotation every X number of pages&lt;/li&gt;&lt;li&gt;AJAX-enabled thumbnail-based navigation&lt;/li&gt;&lt;/ul&gt;Thanks for reading and stay tuned!</content><link rel='replies' type='application/atom+xml' href='http://caughtinthedotnet.blogspot.com/feeds/3346553802232774806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/9155497887072087397/3346553802232774806' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/3346553802232774806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/3346553802232774806'/><link rel='alternate' type='text/html' href='http://caughtinthedotnet.blogspot.com/2009/01/back-from-dead.html' title='Back from the Dead'/><author><name>Max</name><uri>http://www.blogger.com/profile/01877683089903862092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgFa4O9ERBFcGzuLlDnnAh9DErCYxCYvquaCXS3rWjtp7m3awM9Hzvr04UTJY2dv0jGSvv-1X2U57AH2zYuDARdLspERgCNfNNFSAQLfFeCRTq88yfLu7e8nhNcdVrFeE/s220/maxwb3.th.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9155497887072087397.post-5380223859347213371</id><published>2008-09-18T21:48:00.007-04:00</published><updated>2008-09-22T12:58:28.310-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="css"/><category scheme="http://www.blogger.com/atom/ns#" term="drop-down"/><category scheme="http://www.blogger.com/atom/ns#" term="menu"/><category scheme="http://www.blogger.com/atom/ns#" term="microsoft"/><category scheme="http://www.blogger.com/atom/ns#" term="navigation"/><category scheme="http://www.blogger.com/atom/ns#" term="visual studio 2005"/><category scheme="http://www.blogger.com/atom/ns#" term="visual studio 2008"/><category scheme="http://www.blogger.com/atom/ns#" term="xml"/><title type='text'>Dynamic Drop-Down Menus in ASP.Net 2.0 / 3.5</title><content type='html'>One of the most essential components to a solid site is a versatile and intuitive navigational drop-down menu. There are many ways to do this. My goals, as always, when approaching a challenge:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt;Let&#39;s not reinvent the wheel.&lt;/span&gt;&lt;br /&gt;There are many solutions out there. A big point of the .NET Framework is to provide reusable components so that you don&#39;t have to code things from scratch. Chances are it&#39;s already been developed and developed well.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt;Avoid hard-coding where possible.&lt;/span&gt;&lt;br /&gt;It&#39;s all HTML, CSS, and Javascript by the time the menu renders in your browser, but that doesn&#39;t mean you need to code it in that way. We&#39;re trying to build something dynamic and avoid duplicating code from page to page. That means there is going to be a data feed, whether from XML or a database, and a control that can process and display this feed from page to page.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt;Create an elegant, cross-browser compliant solution.&lt;/span&gt;&lt;br /&gt;Some of the out-of-the-box ASP.Net menu controls are not that pretty and don&#39;t really work across all browser platforms, especially Safari (Webkit based... speaking of which - guess what Google&#39;s Chrome uses ;-) ) We need something that will be readable, easy to maintain, and most importantly, work across all browsers.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;I found a couple of methods out there to accomplish this. Peter Bromberg talks about one way in his blog here (&lt;a href=&quot;http://www.eggheadcafe.com/tutorials/aspnet/f4bf9b1a-c934-43be-b026-9f3443fc87c9/build-an-aspnet-20--xml.aspx&quot;&gt;http://www.eggheadcafe.com/tutorials/aspnet/f4bf9b1a-c934-43be-b026-9f3443fc87c9/build-an-aspnet-20--xml.aspx&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;It&#39;s a variation of an ASP.Net 1.1 solution previously published in 2003 by WROX. It works, but it&#39;s a slight modification from the 1.1 version, and it seemed a little cumbersome to customize the look and feel, so I continued to look for something designed specifically for 2.0 and up that would be simple to use out-of-the-box and easy to customize.&lt;br /&gt;&lt;br /&gt;Surely enough, I stumbled upon a solution that met my three goals, written by ScottGu (&lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2006/05/02/444850.aspx&quot;&gt;http://weblogs.asp.net/scottgu/archive/2006/05/02/444850.aspx&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;To build a drop-down menu, we need the following:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Data Feed&lt;/li&gt;&lt;li&gt;CSS Stylesheet&lt;/li&gt;&lt;li&gt;Server-side control that will generate a menu from #1 and #2.&lt;/li&gt;&lt;/ol&gt;The data feed is your standard web.sitemap (&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.sitemap.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/system.web.sitemap.aspx&lt;/a&gt;) that you can build in Visual Studio that looks something like this:&lt;br /&gt;&lt;br /&gt;&lt;p style=&quot;MARGIN: 0px;font-size:8pt;&quot; &gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;MARGIN: 0px;font-size:8pt;&quot; &gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span style=&quot;color:maroon;&quot;&gt;xml&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&quot;&lt;span style=&quot;color:blue;&quot;&gt;1.0&lt;/span&gt;&quot;&lt;span style=&quot;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;encoding&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&quot;&lt;span style=&quot;color:blue;&quot;&gt;utf-8&lt;/span&gt;&quot;&lt;span style=&quot;color:blue;&quot;&gt; ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;MARGIN: 0px;font-size:8pt;&quot; &gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;&lt;/span&gt;&lt;span style=&quot;color:maroon;&quot;&gt;siteMap&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&quot;&lt;span style=&quot;color:blue;&quot;&gt;http://schemas.microsoft.com/AspNet/SiteMap-File-1.0&lt;/span&gt;&quot;&lt;span style=&quot;color:blue;&quot;&gt; &gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;MARGIN: 0px;font-size:8pt;&quot; &gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;&lt;/span&gt;&lt;span style=&quot;color:maroon;&quot;&gt;siteMapNode&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;url&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&quot;&quot;&lt;span style=&quot;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&quot;&quot;&lt;span style=&quot;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&quot;&quot;&lt;span style=&quot;color:blue;&quot;&gt;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;MARGIN: 0px;font-size:8pt;&quot; &gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;&lt;/span&gt;&lt;span style=&quot;color:maroon;&quot;&gt;siteMapNode&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;url&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&quot;&quot;&lt;span style=&quot;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&quot;&quot;&lt;span style=&quot;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&quot;&quot;&lt;span style=&quot;color:blue;&quot;&gt; /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;MARGIN: 0px;font-size:8pt;&quot; &gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;&lt;/span&gt;&lt;span style=&quot;color:maroon;&quot;&gt;siteMapNode&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;url&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&quot;&quot;&lt;span style=&quot;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&quot;&quot;&lt;span style=&quot;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&quot;&quot;&lt;span style=&quot;color:blue;&quot;&gt; /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;MARGIN: 0px;font-size:8pt;&quot; &gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span style=&quot;color:maroon;&quot;&gt;siteMapNode&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;MARGIN: 0px;font-size:8pt;&quot; &gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span style=&quot;color:maroon;&quot;&gt;siteMap&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;The server side control is our typical &lt;?xml:namespace prefix = asp /&gt;&lt;asp:menu&gt;with a SiteMapProvider, which is just responsible for reading in the data feed - in this case our web.sitemap file.&lt;br /&gt;&lt;br /&gt;The CSS is the tricky part. Using out-of-the-box simplified customizations won&#39;t get you your desired result, and if it will, chances are it probably won&#39;t look the same from browser to browser. Our solution:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;FONT-WEIGHT: bold; COLOR: rgb(204,0,0)&quot;&gt;CSS Control Adapter Toolkit for ASP.Net 2.0&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt;&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt;&lt;/span&gt;&lt;/span&gt;You can download it here: &lt;a href=&quot;http://www.codeplex.com/cssfriendly&quot;&gt;http://www.codeplex.com/cssfriendly&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The toolkit essentially takes the worry out of coding for cross-browser compliance by providing ASP.Net controls that are already formatted in CSS to look pretty and the same in all common browsers, which is fantastic, because usually, you have to buy a component like this.&lt;br /&gt;&lt;br /&gt;For our drop-down menu, you can do vertical or horizontal; it uses CSS best practices by utilizing ul/li&#39;s instead of tables.&lt;br /&gt;&lt;br /&gt;Check out &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2006/05/02/444850.aspx&quot;&gt;ScottGu&#39;s blog &lt;/a&gt;to get the code, documentation, and a more detailed explanation of exactly how to build, install, and use the drop-down menu with the CSS Control Adapter Toolkit.&lt;br /&gt;&lt;br /&gt;As always, I welcome your comments.&lt;br /&gt;&lt;/asp:menu&gt;&lt;br /&gt;&lt;asp:menu&gt;&lt;span style=&quot;color:#ff9966;&quot;&gt;&lt;strong&gt;&lt;u&gt;UPDATE - 9/22/08&lt;br /&gt;&lt;/u&gt;As it turns out, the vertical menu doesn&#39;t display the sub-items properly in IE6. That doesn&#39;t work for me as more than 45% of my user base is on IE6. Stay tuned and I will post a fix for it.&lt;/strong&gt;&lt;/span&gt;&lt;/asp:menu&gt;&lt;br /&gt;&lt;p&gt;&lt;asp:menu&gt;&lt;strong&gt;&lt;u&gt;&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/asp:menu&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt;Applies to:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;a href=&quot;http://technorati.com/tag/asp.net+2.0&quot; rel=&quot;tag&quot;&gt;asp.net 2.0&lt;/a&gt; &lt;a href=&quot;http://technorati.com/tag/asp.net+3.5&quot; rel=&quot;tag&quot;&gt;asp.net 3.5&lt;/a&gt; &lt;a href=&quot;http://technorati.com/tag/microsoft&quot; rel=&quot;tag&quot;&gt;microsoft&lt;/a&gt; &lt;a href=&quot;http://technorati.com/tag/visual+studio+2005&quot; rel=&quot;tag&quot;&gt;visual studio 2005&lt;/a&gt; &lt;a href=&quot;http://technorati.com/tag/visual+studio+2008&quot; rel=&quot;tag&quot;&gt;visual studio 2008&lt;/a&gt; &lt;a href=&quot;http://technorati.com/tag/css&quot; rel=&quot;tag&quot;&gt;css&lt;/a&gt; &lt;a href=&quot;http://technorati.com/tag/xml&quot; rel=&quot;tag&quot;&gt;xml&lt;/a&gt; &lt;a href=&quot;http://technorati.com/tag/menu&quot; rel=&quot;tag&quot;&gt;menu&lt;/a&gt; &lt;a href=&quot;http://technorati.com/tag/drop-down&quot; rel=&quot;tag&quot;&gt;drop-down&lt;/a&gt; &lt;a href=&quot;http://technorati.com/tag/navigation&quot; rel=&quot;tag&quot;&gt;navigation&lt;/a&gt; &lt;a href=&quot;http://technorati.com/tag/control+adapter+toolkit&quot; rel=&quot;tag&quot;&gt;control adapter toolkit&lt;/a&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span lang=&quot;NL&quot;   style=&quot;font-family:&#39;Lucida Console&#39;;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://caughtinthedotnet.blogspot.com/feeds/5380223859347213371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/9155497887072087397/5380223859347213371' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/5380223859347213371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/5380223859347213371'/><link rel='alternate' type='text/html' href='http://caughtinthedotnet.blogspot.com/2008/09/dynamic-drop-down-menus-in-aspnet-20-35.html' title='Dynamic Drop-Down Menus in ASP.Net 2.0 / 3.5'/><author><name>Max</name><uri>http://www.blogger.com/profile/01877683089903862092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgFa4O9ERBFcGzuLlDnnAh9DErCYxCYvquaCXS3rWjtp7m3awM9Hzvr04UTJY2dv0jGSvv-1X2U57AH2zYuDARdLspERgCNfNNFSAQLfFeCRTq88yfLu7e8nhNcdVrFeE/s220/maxwb3.th.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9155497887072087397.post-5985860895912600804</id><published>2008-09-10T11:05:00.011-04:00</published><updated>2008-09-10T23:22:51.494-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ajax"/><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="atlas"/><category scheme="http://www.blogger.com/atom/ns#" term="drag"/><category scheme="http://www.blogger.com/atom/ns#" term="drop"/><category scheme="http://www.blogger.com/atom/ns#" term="futures"/><category scheme="http://www.blogger.com/atom/ns#" term="microsoft"/><category scheme="http://www.blogger.com/atom/ns#" term="net 3.5"/><category scheme="http://www.blogger.com/atom/ns#" term="visual studio 2008"/><title type='text'>Making use of the &#39;Drop&quot; in Drag-and-Drop in ASP.NET/AJAX</title><content type='html'>I find it a lot when developers get asked what is AJAX, a very common answer is - &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic;&quot;&gt;it&#39;s that technology that let&#39;s you drag and drop things without leaving the page&lt;/span&gt;. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Working within the .NET 2.0 or the 3.5 framework, there is functionality in the AJAX toolkit that let&#39;s you drag things using the DragPanel control in the AJAX control toolkit (&lt;a href=&quot;http://www.asp.net/AJAX/AjaxControlToolkit/Samples/DragPanel/DragPanel.aspx&quot;&gt;http://www.asp.net/AJAX/AjaxControlToolkit/Samples/DragPanel/DragPanel.aspx&lt;/a&gt;).  Very cool stuff if all you are trying to do is allow the user to reposition things.  If you are trying to extend it for a more practical use, like being able to drag an item to a shopping cart, you don&#39;t really get that functionality out of the box with the AJAX control toolkit.  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Looking at our objective from a 64,000 ft. view, we have this &quot;hot&quot; zone somewhere on a page.  We have a couple of objects that can be dragged onto this zone, and when that happens, we want to be notified exactly what was dragged and to which zone, so that we can fire the appropriate code, such as add the object to our shopping cart.  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;How do we accomplish this given that this functionality is non-existent in the AJAX control toolkit? I was asking myself this question until I ran across a very cool solution by Jeff Prosise who writes for a section in the MSDN Magazine called &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: bold;&quot;&gt;Wicked Code.  &lt;/span&gt;You can subscribe to it here: &lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/rss/?col=Wicked%20Code&quot;&gt;http://msdn.microsoft.com/en-us/magazine/rss/?col=Wicked%20Code&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The caveat with his solution is that it uses the Microsoft.Web.Preview library which comes as part of &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: bold;&quot;&gt;ASP.Net Futures&lt;/span&gt; (downloadable from here - &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyId=A5189BCB-EF81-4C12-9733-E294D13A58E6&amp;amp;displaylang=en&quot;&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=A5189BCB-EF81-4C12-9733-E294D13A58E6&amp;amp;displaylang=en&lt;/a&gt;).  The official description of the ASP.Net Futures is &quot;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: bold;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic;&quot;&gt;Contains features currently being considered for future versions of ASP.NET and the .NET Framework,&lt;/span&gt;&lt;/span&gt;&quot; meaning you probably won&#39;t find too much documentation or support for it... or a guarantee of any sort that it will be included in the next release of the .NET Framework.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is the fine print.  If you are planning on deploying this to a high volume enterprise environment, it&#39;s certainly something to think about, however, Jeff&#39;s solution looks elegant, robust, and customizable to fit your need.  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The code, article, and documentation is available here:&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/cc135985.aspx&quot;&gt;http://msdn.microsoft.com/en-us/magazine/cc135985.aspx&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Great work Jeff!&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;&lt;strong&gt;Applies to:&lt;/strong&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;&lt;a href=&quot;http://technorati.com/tag/.net%203.5%20framework&quot; rel=&quot;tag&quot;&gt;.NET 3.5 Framework&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tag/ajax&quot; rel=&quot;tag&quot;&gt;AJAX&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tag/visual%20studio%202008&quot; rel=&quot;tag&quot;&gt;Visual Studio 2008&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://caughtinthedotnet.blogspot.com/feeds/5985860895912600804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/9155497887072087397/5985860895912600804' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/5985860895912600804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/5985860895912600804'/><link rel='alternate' type='text/html' href='http://caughtinthedotnet.blogspot.com/2008/09/making-use-of-drop-in-drag-and-drop-in.html' title='Making use of the &#39;Drop&quot; in Drag-and-Drop in ASP.NET/AJAX'/><author><name>Max</name><uri>http://www.blogger.com/profile/01877683089903862092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgFa4O9ERBFcGzuLlDnnAh9DErCYxCYvquaCXS3rWjtp7m3awM9Hzvr04UTJY2dv0jGSvv-1X2U57AH2zYuDARdLspERgCNfNNFSAQLfFeCRTq88yfLu7e8nhNcdVrFeE/s220/maxwb3.th.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9155497887072087397.post-6576967844527236567</id><published>2008-09-06T13:40:00.004-04:00</published><updated>2008-09-10T23:16:29.346-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="microsoft"/><category scheme="http://www.blogger.com/atom/ns#" term="os"/><category scheme="http://www.blogger.com/atom/ns#" term="server"/><category scheme="http://www.blogger.com/atom/ns#" term="vista"/><category scheme="http://www.blogger.com/atom/ns#" term="xp"/><title type='text'>Windows 2008 Server - Vista Alternative for your Desktop</title><content type='html'>&lt;span style=&quot;font-size:78%;&quot;&gt;This is a little bit off topic, but needed to be written...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you like the aesthetics of Windows Vista, and, unless you are short on CPU, memory, or video resources, there is no reason not to, you have had debates with yourself.  The almost-too-common debate of whether you should downgrade to XP or stay with Vista and deal with the errors, bugs, and problems... because it&#39;s just a pretty OS.  So how do you get beauty AND brains without going to the Mac store?&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(255, 0, 0);font-family:lucida grande;&quot; &gt;Microsoft Windows 2008 Server&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-size:78%;&quot; &gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;It&#39;s just like Vista, without the stupid bugs&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(255, 0, 0);font-family:lucida grande;&quot; &gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;Yes - that&#39;s the slogan they are going with.&lt;br /&gt;&lt;br /&gt;I recommend this for any users running Vista on their desktops.  The reason I don&#39;t recommend it for laptops is you won&#39;t get the best battery utilization and you won&#39;t have the options of putting your OS to sleep or hibernation.&lt;br /&gt;&lt;br /&gt;To get Windows 2008 Server to act like a workstation, it will take some configuration to make it more user-friendly, and less like a server.  I was referred to a blog that gives step-by-step instructions on accomplishing this:&lt;br /&gt;&lt;a href=&quot;http://www.win2008workstation.com/&quot;&gt;http://www.win2008workstation.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you have 2 days to spare, I recommend you try this out.  Unless you upgrade from 32-bit Vista to a 64-bit Windows 2008 Server, most of your Vista drivers should work without a problem.&lt;br /&gt;&lt;br /&gt;Use Macrium Reflect (&lt;a href=&quot;http://www.macrium.com/reflectfree.asp&quot;&gt;click for free download&lt;/a&gt;) to ghost your current image, in case you want to go back.&lt;br /&gt;&lt;br /&gt;To download the trial evaluation, check out:&lt;br /&gt;&lt;a href=&quot;http://www.microsoft.com/windowsserver2008/en/us/trial-software.aspx&quot;&gt;http://www.microsoft.com/windowsserver2008/en/us/trial-software.aspx&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;&lt;br /&gt;Applies to:&lt;br /&gt;&lt;a href=&quot;http://technorati.com/tag/microsoft%20windows%20xp&quot; rel=&quot;tag&quot;&gt;Microsoft Windows XP&lt;/a&gt;, &lt;a href=&quot;http://technorati.com/tag/vista&quot; rel=&quot;tag&quot;&gt;Vista&lt;/a&gt;, &lt;a href=&quot;http://technorati.com/tag/windows%20server%202008&quot; rel=&quot;tag&quot;&gt;Windows Server 2008&lt;/a&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://caughtinthedotnet.blogspot.com/feeds/6576967844527236567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/9155497887072087397/6576967844527236567' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/6576967844527236567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/6576967844527236567'/><link rel='alternate' type='text/html' href='http://caughtinthedotnet.blogspot.com/2008/09/windows-2008-server-vista-alternative.html' title='Windows 2008 Server - Vista Alternative for your Desktop'/><author><name>Max</name><uri>http://www.blogger.com/profile/01877683089903862092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgFa4O9ERBFcGzuLlDnnAh9DErCYxCYvquaCXS3rWjtp7m3awM9Hzvr04UTJY2dv0jGSvv-1X2U57AH2zYuDARdLspERgCNfNNFSAQLfFeCRTq88yfLu7e8nhNcdVrFeE/s220/maxwb3.th.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9155497887072087397.post-9017214463499530101</id><published>2008-09-05T10:18:00.002-04:00</published><updated>2008-09-10T23:19:50.444-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".net"/><category scheme="http://www.blogger.com/atom/ns#" term="ajax"/><category scheme="http://www.blogger.com/atom/ns#" term="authenticationservice"/><category scheme="http://www.blogger.com/atom/ns#" term="encryption"/><category scheme="http://www.blogger.com/atom/ns#" term="https"/><category scheme="http://www.blogger.com/atom/ns#" term="visual studio 2008"/><title type='text'>Workaround to AuthenticationService security issue over HTTP</title><content type='html'>&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;&lt;/span&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;It&#39;s very convenient to be able to log in on a nice &amp;amp; functional page without leaving to go to a special secure &amp;amp; encrypted login page, hoping to be brought back to the page that you were on with all your work saved.  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The AJAX Framework in NET 3.5 provides a web service to help us accomplish that: AuthenticationService (&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb386582.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/bb386582.aspx&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;If you are already on an encrypted HTTPS page, this works great.  However, if you are serving out that nice &amp;amp; functional page over HTTP, because frankly, you don&#39;t need images or text encrypted, and would rather not use up overhead just for the sake of a login form, you may have a problem.&lt;br /&gt;&lt;br /&gt;Specifying the line below in your web.config won&#39;t really do anything.&lt;br /&gt;&lt;span style=&quot;color: rgb(153, 0, 0);font-family:courier new;&quot; &gt;&lt;code&gt;&amp;lt;authenticationservice enabled=&quot;true&quot; requiressl=&quot;true&quot;&amp;gt;&amp;lt;/authenticationservice&amp;gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Changing the protocol to HTTPS in your path won&#39;t help you either:&lt;br /&gt;&lt;span style=&quot;color: rgb(153, 0, 0);font-family:courier new;&quot; &gt;&lt;code&gt;&amp;lt;asp:scriptmanager runat=&quot;server&quot;&amp;gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(153, 0, 0);font-family:courier new;&quot; &gt;  &amp;lt;authenticationservice path=&quot;https://localhost/MyAuthService.asmx&quot;&amp;gt;&amp;lt;/authenticationservice&amp;gt;&amp;lt;/asp:scriptmanager&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Why? Because it so happens that this version of AJAX, included in .NET 3.5 does not support cross-domain proxy authentication.&lt;br /&gt;&lt;br /&gt;So, how do you solve the problem of making sure your user&#39;s credentials don&#39;t get traced through unencrypted HTTP headers while keeping the page served over HTTP and not redirecting him/her anywhere?&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 255);font-family:verdana;&quot; &gt;MD5 encryption via Javascript&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Before the password gets posted to your ASP.Net form, you encrypt it with MD5.  MD5 is a one-way encryption algorithm that cannot be decrypted.  To use it, you:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Encrypt the submitted password value.&lt;/li&gt;&lt;li&gt;Encrypt the DB-stored password associated with the submitted email address.&lt;/li&gt;&lt;li&gt;Compare the two values.  If equal, you can deem the authentication successful.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;With no need to reinvent the wheel, I found a great script for encrypting strings into MD5 format here:&lt;br /&gt;&lt;a href=&quot;http://pajhome.org.uk/crypt/md5/&quot;&gt;http://pajhome.org.uk/crypt/md5/&lt;/a&gt;&lt;br /&gt;Great work Paul!&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Conclusion&lt;/span&gt;&lt;br /&gt;With the shortcomings of the AJAX toolkit inside of .NET 3.5 Framework, Visual Studio 2008 is still a great IDE and before you go switching to PHP, all it takes is some time, creativity, and improvisation.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Is it safe to use client-side encryption?&lt;/span&gt;&lt;br /&gt;Yes.  Our goal is to prevent the HTTP headers from being compromised or traced in midstream, before they get to the server they are going to.  As long as you are on a browser that supports JavaScript, Paul&#39;s MD5 function should do the trick.&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;I will post some code later.  I welcome  your feedback.&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:78%;&quot; &gt;&lt;br /&gt;Applies to: &lt;br /&gt;&lt;a href=&quot;http://technorati.com/tag/visual%20studio%202008&quot; rel=&quot;tag&quot;&gt;Visual Studio 2008&lt;/a&gt;, &lt;a href=&quot;http://technorati.com/tag/.net%203.5&quot; rel=&quot;tag&quot;&gt;.NET 3.5&lt;/a&gt;, &lt;a href=&quot;http://technorati.com/tag/ajax&quot; rel=&quot;tag&quot;&gt;AJAX&lt;/a&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://caughtinthedotnet.blogspot.com/feeds/9017214463499530101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/9155497887072087397/9017214463499530101' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/9017214463499530101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9155497887072087397/posts/default/9017214463499530101'/><link rel='alternate' type='text/html' href='http://caughtinthedotnet.blogspot.com/2008/09/workaround-to-authenticationservice.html' title='Workaround to AuthenticationService security issue over HTTP'/><author><name>Max</name><uri>http://www.blogger.com/profile/01877683089903862092</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgFa4O9ERBFcGzuLlDnnAh9DErCYxCYvquaCXS3rWjtp7m3awM9Hzvr04UTJY2dv0jGSvv-1X2U57AH2zYuDARdLspERgCNfNNFSAQLfFeCRTq88yfLu7e8nhNcdVrFeE/s220/maxwb3.th.jpg'/></author><thr:total>0</thr:total></entry></feed>