Custom Error Page with Log Support Ticket Link for SharePoint 2010

We’ve all seen it; the SharePoint 2010 error message with its bold red X yelling at us that we have done something terribly wrong (like it’s our fault!). Every time I see it I think of the Tommy Boy line “What’d you do!!?”

Posted in Configuration | Tagged | 1 Comment

Missing EXE Extension for IE Downloads

I was recently working with one of our client’s websites to switch their downloads to an external Content Delivery Network (CDN). After making the transition, we started seeing a strange behavior in IE when downloading an EXE file… the extension was missing. The odd thing was that all the other browsers we tested worked correctly.

Posted in Internet Explorer | Leave a comment

SharePoint Feature Receiver code for bin deployments

NOTE:  If your feature receiver code needs to access the main Presentation assembly, you will receiver an error saying that the assembly UNOS.[app].Presentation cannot be loaded- this happens because the assembly is added to the bin, then the feature receiver code runs before the app pool recycles, so the assembly is never loaded into context.  To work around this, add this line to your feature receiver code:

Posted in Uncategorized | Leave a comment

Adding to a SharePoint 2010 List with Lookups

I had a situation recently where I was building a form in SharePoint 2010. I used a main list for the form and several other lists as lookup values for some of the fields. I used a .NET User Control for the UI, and SPMetal and LINQ to interact with SharePoint. This was my first time using SPMetal, and I had trouble adding items to the main list. The error was coming from the lookup fields. I eventually figured out that you can’t assign lookup field values to an item while you are adding it. You have to create the item first without the lookup values, then go back and add them.

Posted in Development, Linq to SharePoint, SharePoint 2010 | Tagged , , | Leave a comment

Team Foundation Server: Unshelving another user’s changes across branches

Unshelving code between branches can be difficult enough on its own but once you add another developer into the mix things can get a bit dicey since Visual Studio does not have a built-in wizard to do this.

Posted in .Net, Visual Studio | Leave a comment

Insert JavaScript into a Content Editor Web Part (CEWP)

In the 2007 version of SharePoint, we had the Source Editor included in the Content Editor Web Part (CEWP) as our way of inputting JavaScript directly onto a page. The process on how to do this has changed a little bit in the new 2010 version. Follow below on how to successfully perform the same task.

Posted in Development | Tagged , | 1 Comment

Add Top Link Bar Inheritance using PowerShell for SharePoint 2010

I would like to kick off the New Year with perhaps my shortest blog entry for 2012!

Posted in Administration, PowerShell | Tagged | 2 Comments

Developing a Webpart with a Dynamic UI

One of the problems I run into when writing web parts that display SharePoint data is when the UI is dependent on dynamic content. In the past I have generated the HTML on the server-side. This works but it not the best solution as C# is not the best language to code HTML in. Also separation of concerns  is an important principle to me and I want my UI separated from my server-side logic so that server changes are isolated from UI changes and vice versa. The the solution I came up with utilized several different technologies and has shown to be flexible and robust to changes.

Posted in .Net, Development, Development, JavaScript, JQuery, SharePoint 2007, SharePoint 2010 | 2 Comments

ASP.NET Dynamic HTML with HTML Controls

There are many times that you need to process a data list and generate HTML to output to an ASP.NET page. Most of the time, a Repeater is the best choice for this, but sometimes using a Repeater is not practical because the HTML has too many levels or is built with too many conditionals. In these cases, you could use a StringBuilder and output the result to a Literal control, but working with strings can be error prone. My preferred method to add a Placeholder control to the page and then just add Controls to its Controls collection in the code behind.

Posted in ASP.NET | Tagged , | Leave a comment

Debugging a T4 Template

T4 templates are extremely useful for generating repetitive code quickly and reliably.  Getting them to produce good code can prove to be tricky for anything less than a trivial example.  If you are having issues, stepping through the template to see what is going awry can prove difficult as there is little debugging support right out of the box. 

Posted in .Net | 1 Comment