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

Forums / General Discussions / Using JQuery

Using JQuery

7 posts, 0 answered
  1. Richard Warner
    Richard Warner avatar
    13 posts
    Registered:
    23 Feb 2010
    06 Apr 2010
    Link to this post
    Hi,

    Is there any beginner guides to adding jQuery support to Sitefinity. I have had a look at the forum and can only find limited information of adding jQuery support. I have had a look at the post

    http://www.sitefinity.com/blogs/georgichokov/posts/09-03-25/how_to_use_jquery_and_other_javascript_libraries_in_sitefinity.aspx

    and have now altered a site master page to the following. Is this correct?

    <%@ Master Language="C#" %>
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sf" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="sf" %>  
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <script runat="server">
         
    </script>
     
    <head runat="server">
        <title></title>
     
     
    <asp:ContentPlaceHolder id="head" runat="server">
        </asp:ContentPlaceHolder>
    </head>
    <body>
    <sf:JsFileLink id="jsLink" runat="server" ScriptType="jQuery"></sf:JsFileLink>
       <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
             
            </asp:ScriptManager>
    <div id="Newloginpos"></div>
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    06 Apr 2010
    Link to this post
    Hi Richard Warner,

    Thank you for using our services.

    This approach is correct, however it will add a reference to the jQuery version embedded in the Sitefinity assemblies. If you wish to get a refference to the latest version I can suggest that you add this to your script manager:
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" ScriptMode="Release" EnableScriptCombine="true">
       <Scripts>
           <asp:ScriptReference Path="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" />
       </Scripts>
    </telerik:RadScriptManager>

    This will add a reference to the 1.4.2 minified version of jQuery from Google jQuery CDN. Alternatively you can get the js file and load it from your server instead of CDN.

    Regards,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Richard Warner
    Richard Warner avatar
    13 posts
    Registered:
    23 Feb 2010
    07 Apr 2010
    Link to this post
    Hi,

    I added the code as you suggested and now get an error

    Server Error in '/' Application.

    Object reference not set to an instance of an object.

    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.NullReferenceException: Object reference not set to an instance of an object.

    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:

    [NullReferenceException: Object reference not set to an instance of an object.]
       Telerik.Cms.Web.EditPage.CreateChildControls() +280
       System.Web.UI.Control.EnsureChildControls() +145
       System.Web.UI.Control.PreRenderRecursiveInternal() +60
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3393
    

    <%@ Master Language="C#" %>
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sf" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="sf" %>  
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <script runat="server">
         
    </script>
     
    <head runat="server">
        <title></title>
     
     
    <asp:ContentPlaceHolder id="head" runat="server">
        </asp:ContentPlaceHolder>
    </head>
    <body>
     
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" ScriptMode="Release" EnableScriptCombine="true">
       <Scripts>
           <asp:ScriptReference Path="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" /><asp:ScriptReference />
       </Scripts>
    </telerik:RadScriptManager>
    <div id="Newloginpos"></div>
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Apr 2010
    Link to this post
    Hello Richard Warner,

    Try using the following content for the master page

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
          
    </script>
      
    <head id="Head1" runat="server">
        <title></title>
      
    </head>
    <body>
     <form runat="server" id="sds">
    <asp:ScriptManager runat="server" ID="ScriptManager1">
       <Scripts>
           <asp:ScriptReference Path="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"/>
       </Scripts>
    </asp:ScriptManager>
         <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server" />
    <div id="Newloginpos"></div>
    </form>
    </body>
    </html>

    The error you are getting is thrown, because some of the controls you have on the master page is null.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Gabe Sumner
    Gabe Sumner avatar
    440 posts
    Registered:
    09 Sep 2007
    01 Sep 2011
    Link to this post
    I'm updating this post because it has fairly high SEO value.

    --

    This forum post pertains to using jQuery in Sitefinity 3.x.  We have a blog post devoted to this subject:

    - How to use jQuery and other Javascript Libraries in Sitefinity 3.x

    However, for Sitefinity 4.x developers, there is an updated version of this post:

    - How to use jQuery and other Javascript Libraries in Sitefinity 4.x

    Hopefully these posts will help guide anyone who is interested in using jQuery with Sitefinity.

    Best wishes,

    Gabe Sumner
    Evangelist
    Telerik | Sitefinity CMS
  6. Blandine
    Blandine avatar
    1 posts
    Registered:
    10 Sep 2013
    11 Feb 2014 in reply to Gabe Sumner
    Link to this post
    Hi,
    The second link actually does not work and I am looking for some recent articles for recent versions(ex 6.500)
  7. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    07 Dec 2016
    13 Feb 2014
    Link to this post
    Hi Blandine,

    You could check this blog post where you could find information how to use jQuery and other JavaScript Libraries in Sitefinity.

    I hope this helps.

    Regards,
    Svetoslav Manchev
    Telerik
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
Register for webinar
7 posts, 0 answered