More in this section

Forums / Developing with Sitefinity / java script not working

java script not working

9 posts, 0 answered
  1. indu
    indu avatar
    6 posts
    Registered:
    17 Mar 2008
    12 Nov 2008
    Link to this post
    hello,
    we have used a greybox script (java script) in our pages.

    we have included these js scripts in master page. and when applying the template (master page) to an aspx page, greybox doesnt work.
     
    cud u make us clear wher to upload these js files for the greybox to work?

    for ex: this is how we have included js in master page

      <script type="text/javascript">
        var GB_ROOT_DIR = "/productsnew/greybox/";
    </script>
    <script type="text/javascript" src="greybox/AJS.js"></script>
    <script type="text/javascript" src="greybox/AJS_fx.js"></script>
    <script type="text/javascript" src="greybox/gb_scripts.js"></script>
    <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" />

    thnks,
    indu


  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    13 Nov 2008
    Link to this post
    Hi indu,

    I would recommend you use Sitefinity CssFileLink and JsFileLink controls to include greybox css/js files in the head section of the page. Here is an example:

    <%@ Master Language="C#" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <script runat="server"
     
    </script> 
     
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head runat="server"
        <title>Untitled Page</title> 
        <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
        <script type="text/javascript"
            var GB_ROOT_DIR = "/Sitefinity3.5SP1/greybox/"
        </script> 
    </head> 
    <body> 
        <form id="form1" runat="server"
            <asp:ScriptManager ID="ScriptManager1" runat="server"
            </asp:ScriptManager>  
            <sfWeb:JsFileLink ID="JsFileLink1" runat="server" FileName="~/greybox/AJS.js" /> 
            <sfWeb:JsFileLink ID="JsFileLink2" runat="server" FileName="~/greybox/AJS_fx.js" /> 
            <sfWeb:JsFileLink ID="JsFileLink3" runat="server" FileName="~/greybox/gb_scripts.js" /> 
            <sfWeb:CssFileLink ID="CssFileLink1" FileName="~/greybox/gb_styles.css" Media="screen" runat="server" /> 
    ... 

    Do let us know if this helps.

    All the best,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. indu
    indu avatar
    6 posts
    Registered:
    17 Mar 2008
    14 Nov 2008
    Link to this post
    hello,

    var GB_ROOT_DIR = "/Sitefinity3.5SP1/greybox/";

    where to find this folder?  it is a user created folder?

    plz elaborate
  4. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    14 Nov 2008
    Link to this post
    Hello indu,

    If I understand correctly you want to use GreyBox library in your project. So /Your_Project_Name/greybox/ is the path to the folder which contains GreyBox  files (.js and .css):

    var GB_ROOT_DIR = "/Your_Project_Name/greybox/";  

    Please describe in details if there is some misunderstanding.

    Best wishes,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. indu
    indu avatar
    6 posts
    Registered:
    17 Mar 2008
    14 Nov 2008
    Link to this post
    hi,
    we have tried using the project name also

    but something doesnt seem to work!

    <script type="text/javascript">

    var GB_ROOT_DIR = "/productredesign/greybox/";

    </script>


    and greybox is inside this productredesign folder only!

    plz suggest on resolving this.

    Thnks,
    Indu
  6. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    17 Nov 2008
    Link to this post
    Hi indu,

    Most probably the reason for the issue is that greybox .js and .cs files (AJS.js, AJS_fx.js, gb_scripts.js and gb_styles.css) are not applying. So please try to use Sitefinity CssFileLink and JsFileLink controls as it was described in my first post to include these files into the page.

    Do let us know how it goes.

    Greetings,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Dino
    Dino avatar
    21 posts
    Registered:
    13 Jan 2008
    19 Nov 2008
    Link to this post
    I have same problem I cannot add library .js or .css to the page.
    Can you find out a solution ?
  8. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    20 Nov 2008
    Link to this post
    Hello Dino,

    I believe the problem got fixed in the support thread today. I will post the solution here as well:
    <%@ Master Language="C#" %>  
    <script type="text/javascript" src='<% =this.Page.ResolveUrl("~/App_Master/JS_Call/script.js")%>'></script>  
      
    <HTML xmlns="http://www.w3.org/1999/xhtml" >  
    <head runat="server">  
      
    ....  
    </HTML>  

    Greetings,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. Dino
    Dino avatar
    21 posts
    Registered:
    13 Jan 2008
    20 Nov 2008
    Link to this post
    Hello indu
    Yes it's correct.. that fix the problem.
    cheers
    D.
Register for webinar
9 posts, 0 answered