VS.NET Extensions for Sharepoint

My experience with developing for Sharepoint was very painful.  The jist of it was, unless you are truly going to hook into a lot of the core functionality of sharepoint (document collaboration and workflow) it will be MUCH harder to build an app to run in sharepoint than it would be to build a standalone application.

But MS has released some new extensions that will hopefully ease the pain a little bit:

Announcing: Visual Studio extensions for SharePoint – Developer User Guide

I don’t know if I will ever have enough time to implement anything in sharepoint, but these will be nice to have.

Highslide

We have been working with a pretty cool little javascript toolkit called Highslide.

http://vikjavev.no/highslide/

It gives you some nice lightbox type effects but I like it more because of some of the options to load in iframes and stuff.

Someone wrote some asp.net wrappers as well to make it easier to add to your pages:

http://encosia.com/

 

Visual Studio .Net 2008 – Making sense of all the versions

Microsoft really does a terrible job explaining all the variations of Visual Studio .Net 2008 (and there are many):

  • Visual Web Developer 2008 Express Edition
  • Visual Basic 2008 Express Edition
  • Visual C# 2008 Express Edition
  • Visual C++ 2008 Express Edition
  • Visual Studio 2008 Standard Edition
  • Visual Studio 2008 Professional Edition
  • Visual Studio Team System 2008 Architecture Edition
  • Visual Studio Team System 2008 Database Edition
  • Visual Studio Team System 2008 Development Edition
  • Visual Studio Team System 2008 Test Edition
  • Visual Studio Team System 2008 Team Suite

After a lot of searching, I finally found this data sheet that explains most of it.

Why this was so hard to find is anyones guess.

Where did my columns go?

I just noticed this while working on a windows forms .net application.

I made some changes to the underlying business objects that I had bound to a datagridview.  Things looked like they should at runtime, but when I opened up the designer, several of my columns were missing!

After some testing around, I realized that any column that was bound to a property on the object, where I had changed the name of the property, was no longer showing.

I figured it would fail the databind or something, but at least let me change the column details to get things working right!

So I added in fake empty property definitions to the business objects and presto: back come the columns.

After that, I was able to update the databinding field and remove my bogus properties.

 

Using a STYLE block on a page with a Master Page

I have been asked this a few times, so I decided to write up a little article on it.

The problem is that when you are using master pages in asp.net, the <HEAD> is usually inside the master page template.  So if you are on a page that needs a 1 off change or addition to the style of the rest of the site, you are unable to create a <STYLE> element in your content page.

Well, you CAN create one, but then VS.Net won’t show you the designer for your page b/c it keeps asking you to clean up the HTML problems on your page.

The solution I have used is to create a 2nd content place holder in the master page head.  But, I might as well not duplicate effort here, as Rick Strahl has already written the article I am about to write (and apparently, even someone else beat him to the punch).

http://www.west-wind.com/WebLog/posts/5706.aspx

This works very well for this type of situation. 

 

What could cause this casting error?

Error:

Unable to cast object of type ‘System.Collections.Generic.List`1[EditQuoteController+UnsavedQuoteItemInfo]’ to type ‘System.Collections.Generic.List`1[EditQuoteController+UnsavedQuoteItemInfo]’.

Yes, you read that right.  Unable to cast object of type X to type X.

I have seen this type of error once before and it was when there were multiple assemblies referencing different version of a common assembly, so even though their names were the same, their versions were different.

But in this instance there is nothing like this that could be having an impact.  All of the classes of consequence are in the same assembly.

Also, I don’t get exception very often, only every now and then.

UPDATE:

I think maybe this is happening between builds on my development machine b/c I am storing some data in the session.  So the version in session was from the last build?  Doesn’t sound like a great explanation, but it’s the best I have at this point.

UPDATE 2:

I am pretty sure that what I wrote in the last update is what is actually happening. 

I used this code:

Try
    list = CType(view.Session.Item(Me.UnsavedKey), List(Of UnsavedQuoteItemInfo))
Catch ex As System.InvalidCastException
    Dim sError As String = "Unable to cast from type " & _
        view.Session.Item(Me.UnsavedKey).GetType.AssemblyQualifiedName & _
        " to type " & GetType(List(Of UnsavedQuoteItemInfo)).AssemblyQualifiedName & _
        ".  The session has been cleared."
    view.Session.Item(Me.UnsavedKey) = Nothing
    Throw New System.ApplicationException(sError)
End Try

Which producted the following 2 types:

System.Collections.Generic.List`1[[EditQuoteController+UnsavedQuoteItemInfo, App_Web_bp-bbqew, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=2.0.0.0, Culture=neutral PublicKeyToken=b77a5c561934e089

System.Collections.Generic.List`1[[EditQuoteController+UnsavedQuoteItemInfo, App_Web_ve7ziow-, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. 

I am guessing this is a by product of using the web site project, instead of web application project.  There are some other reasons why we wanted to use web site instead of web app on this project, so you don’t have to scold me: we made the right choice.

But it seems that every time I make a change to the project, it creates a new dynamically named assembly.  So even though the classes are really the same, they are globally different as far as asp.net is concerned.

 

WebAii Website Automated Testing Framework

I am always on the lookout for better and easier ways to automate testing of my applications.  Mostly, this stems from my teams not being too keen on implementing testing, so the easier I can make it, the easier it will be to convince others to write tests.

So Phil Haack has suggested a free framework called WebAii, and after taking a quick look, it looks promising.

It supports some nice features like mouse/keyboard actions for Ajax testing, and dom actions (find an element and click it, or whatever).  It also supports unit testing your javascript functions by having your test call the functions.  It also integrates with Nunit.  Nice!

Hopefully I can find some free time (HAHAHHAAH) when I can test this out more in a project.

 

Free Flyout and Alternating Panel Controls

These are some nice looking, cross browser compliant, ASP.NET based, free controls from Obout.com

Flyout can perform stuff like this:

But almost more interesting is how it can be used in conjunction with traditional controls.  For example, you can wire up a nice looking “Alt Text” effect for images and labels, and you can provide some nice explanation in the flyout for how to properly fill in a control.  The example they give on their site shows a textbox for “Routing Number” and when you click on the textbox it shows this in the flyout:

 

 

The alternating content control which is called “Show” (Show examples) can rotate through some content like so:

These are both free controls.  Very nice!