Server Error in '/' Application
I'm getting the following error when trying to add in a javascript file using the embedded approach. Whatever I put into AssemblyInfo="Anything", (the example is setting AssembyInfo="SitefinityWebApp.JS, SitefinityWebApp") I get the following error:
Server Error in '/' Application.
Type "SitefinityWebApp.JS, SitefinityWebApp" cannot be resolved.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Type "SitefinityWebApp.JS, SitefinityWebApp" cannot be resolved.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: Type "SitefinityWebApp.JS, SitefinityWebApp" cannot be resolved.]
Telerik.Sitefinity.Utilities.TypeConverters.TypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +1242
Telerik.Sitefinity.Web.UI.ResourceLinks.RegisterResource(ResourceFile resource) +107
Telerik.Sitefinity.Web.UI.ResourceLinks.CreateChildControls() +541
System.Web.UI.Control.EnsureChildControls() +83
System.Web.UI.Control.PreRenderRecursiveInternal() +42
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974
Here is the code I am using:
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
<sf:ResourceLinks ID="ResourceLinks1" runat="server">
<sf:ResourceFile JavaScriptLibrary="JQuery"></sf:ResourceFile>
</sf:ResourceLinks>
<sf:ResourceLinks ID="ResourceLinks2" runat="server">
<sf:ResourceFile Name="SitefinityWebApp.JS.hello.js" AssemblyInfo="SitefinityWebApp.JS, SitefinityWebApp" Static="true"></sf:ResourceFile>
I've now done this using the Code Behind method outlined in the Sitefinity manual. I think this is overkill just to add some javascript. Would still like to know how to use the markup method - if anyone has actually done this - please let me know how.
David,
This is how I've accomplished it in the past:
<
sf:ResourceLinks
ID
=
"ResourcesLinks1"
UseEmbeddedThemes
=
"True"
runat
=
"server"
>
<
sf:ResourceFile
JavaScriptLibrary
=
"JQuery"
/>
<
sf:ResourceFile
Name
=
"SitefinityWebApp.JS.hello.js"
AssemblyInfo
=
"SitefinityWebApp.SomeControlInTheNamespace, SitefinityWebApp"
Static
=
"True"
></
sf:ResourceFile
>
</
sf:ResourceLinks
>
And then, making sure that I have the resource set to "Embedded Resource" and referenced in AssemblyInfo.cs, like so:
[assembly: WebResource(
"SitefinityWebApp.JS.hello.js"
,
"application/x-javascript"
)]
Thanks Tim,
I'm going to stick with the code behind now I've gone and done it for now. If I get sometime I will come back and change this around though as I much prefer this method. I hope Sitefinity update the manual to this example since this is how Sitefinity originally sets up the project.