Could Not Load Type Error
Recently I was working on a method to get a Flash file to read from a SharePoint list (more on that later…). I had a working solution, so I created my solution package and deployed it to our test servers. Rather than seeing my spiffy new application page (_layouts/catapult/spiffy.aspx) I received the following error:
"Could not load type."
Without going into all of the other solutions I tried, I found this post. I sat there for a minute and thought, how am I going to do that in a solution? I am almost done…it’s almost Happy Hour!
A quick note to a trifecta of SharePoint Development Heroes (Robert Bogue, Scot Hillier, and Andrew Connell) and I learned that code behinds don’t work in SharePoint unless you use the 4 part name to reference the assembly. So I changed the page directive in my aspx page from:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Spiffy.aspx.cs" Inherits="CatapultSystems.SharePoint.Applications" %>
To:
<%@ Page Language="C#" AutoEventWireup="true" Inherits="CatapultSystems.SharePoint.Applications.Spiffy, CatapultSystems.SharePoint.Applications, Version=1.0.0.0, Culture=neutral, PublicKeyToken=###########" %>
When I redeployed the page everything worked perfectly. I have never professed to be a “real” developer. I just stand in awe of guys like Robert, Scot, and Andrew who really have a deep understanding of what makes the technology tick. (And have the scars to prove it.)
BTW, Andrew has a great article on how you can use code behinds in SharePoint. Thanks Guys!
Ready to start your next project with us? That’s great! Give us a call or send us an email and we will get back to you as soon as possible!
+1.512.539.0322