0

I am trying to create a SharePoint 2010 web part. The web part I am trying to create will contain, amongst other things, a custom asp.net server control as a dll. The dll refers to a number of files including a .js file that are all contained in a resources directory. This all works perfectly when I create a generic web part, I can add a reference to the dll and include the resources directory in the VS 2010 project - I can then use the web part and the control it contains with no problems at all. The problem I have is that when I try and create a web part to use in SharePoint 2010 the web part is visible in the SharePoint web part gallery, and the web part can be added to a page, but the control inside my web part (my asp.net control) is never initialised. I believe that this may because the .js file in my resources folder, which my control requires, is not able to be called when the solution is deployed to SharePoint??? I'm a first time SharePoint developer so any thoughts or ideas on where I should be placing these files, or where I am going wrong would be very greatly appreciated! Thank you!

1 Answers1

0

Your dll must be signed with a strong name, that means it has to be compiled using a key in visual studio. You must also ensure that this dll is registered as safe in the sharepoint site web.config.

Eric Herlitz
  • 25,354
  • 27
  • 113
  • 157
  • Hello Eric, thank you for taking the time to help. I really appreciate it. I have signed the dll with a strong name, added it to the GAC and updated the web.config file on my SharePoint site. Sadly still no luck. – user3510199 Apr 08 '14 at 14:57
  • In my web part the js file is not called from the code, it's provided as part of the required parameter set of the control:


    The .js file is in the download directory. This works in the generic web part, but not in the SharePoint one
    – user3510199 Apr 08 '14 at 14:59
  • In my generic web part, my control, the textbox and button are all displayed and working fine. In the web part that I try to create and deploy to SharePoint, only the textbox and button are visible. – user3510199 Apr 08 '14 at 15:00
  • 1
    Thank you Eric for all you help and advice - it is VERY much appreciated. Deploying the js and other required files to the Layouts folder did the trick and by referencing that folder in my web part I'm able to run my control! Eureka, and thanks again! – user3510199 Apr 15 '14 at 16:41