1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / How to included an embedded js file

How to included an embedded js file

4 posts, 0 answered
  1. AmrElsayed
    AmrElsayed avatar
    87 posts
    Registered:
    18 Jul 2012
    18 Dec 2011
    Link to this post

    Hello,

    I am asking about how to embed a js file in a custom widget, I am following the steps below however I got the error attached in "Error.png":
    1- Set the "BuildAction" of the js file is set to "EmbeddedResource" (please review "JsBuildAction,png")
    2- Add the registration of the js file in the AssemblyInfo.cs of the web application 

    [assembly: System.Web.UI.WebResource("SitefinityWebApp.ImageControl.jquery.prettyPhoto.js", "text/javascript")]

    3- add a link to the js file from my custom widget

    <sitefinity:ResourceFileName="SitefinityWebApp.ImageControl.jquery.prettyPhoto.js"AssemblyInfo="SitefinityWebApp" />


    Am I missing something?

    Thanks, 
    Amr

  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    21 Dec 2011
    Link to this post
    Hello Amrelsayed,

    Can you try to make the registration as bellow:
    <sf:ResourceLinks id="resourcesLinks1" runat="server" UseEmbeddedThemes="true">
      <sf:ResourceFile Name="SitefinityWebApp.ImageControl.jquery.prettyPhoto.js" AssemblyInfo="SitefinityWebApp.ImageControl, SitefinityWebApp"/>
    </sf:ResourceLinks>

    Where the highlighted part is the class name of the control in which you are going to use the extension.

    All the best,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    04 Jan 2012
    Link to this post
    I am trying to use the ResourceLinks control to embed a JS file a CSS file along with including the built-in JQuery. I think I have all the steps correct, but no go. Looks like an issue with Sitefinity maybe. Here is what I did:

     1) Set the build action to embedded for the js and css files

    2) Add this to AssemblyInfo.cs:

    [assembly: WebResource("SitefinityWebApp.Widgets.Ads.Resources.JavaScript.plugin.js", "text/javascript")]

    [assembly: WebResource("SitefinityWebApp.Widgets.Ads.Resources.Stylesheets.internAds.css", "text/css")]

    3) Added the correct resource links format to the template files:

    <sf:ResourceLinks ID="resourcesLinks" runat="server">

        <sf:ResourceFile JavaScriptLibrary="JQuery" />

        <sf:ResourceFile

            Name="SitefinityWebApp.Widgets.Ads.Resources.JavaScript.plugin.js"

            AssemblyInfo="SitefinityWebApp.Widgets.Ads.InternAd, SitefinityWebApp" />

        <sf:ResourceFile

            Name="SitefinityWebApp.Widgets.Ads.Resources.Stylesheets.internAds.css"

            AssemblyInfo="SitefinityWebApp.Widgets.Ads.InternAd, SitefinityWebApp" /> </sf:ResourceLinks>

    Note that I am including the widget right in the SitefinityWebApp project instead of using a compiled widget.

    Your help will be really appreciated.

    Thanks,

    G

  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    05 Jan 2012
    Link to this post
    Hello,

    Can you try setting the UseEmbeddedThemes property on ResourceLinks control to true? Also for the CSS file, please set the Static property to true.

    All the best,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
4 posts, 0 answered