$find returning null

4 posts, 1 answers
  1. xr280xr
    xr280xr avatar
    13 posts
    Member since:
    Aug 2013

    Posted 21 Nov 2013 Link to this post

    I am trying to determine why a Rad Rotator on one of our pages has stopped displaying it's items. When the page loads, it should display an image but no longer does. I can see in the source that the images are there, but hidden. I noticed that our javascript that tries to change to the next item is getting null for the rotator:

    function showNextItem(dir) {
     
            var oRotator = $find('<%= RadRotator1.ClientID %>');
     
            if (dir == 0) {
                oRotator.showNext(Telerik.Web.UI.RotatorScrollDirection.Right);
            }
            else {
                oRotator.showNext(Telerik.Web.UI.RotatorScrollDirection.Left);
            }
     
     
        }

    for the rotator declared:
    <tr:RadRotator ID="RadRotator1" runat="server" ...>

    In the script above $find returns null. I'm not sure what's going on.

    What is really confusing is this page belongs to an internal SharePoint extranet site. This site is extended to a public internet site. On the internal site, the rotator works. It's only not working on the external site. If you're not familiar with this model, the sites have their own configuration and IIS application, but both serve the exact same page. So I don't believe it's anything to do with the script above or the declaration of the rotator control.
  2. xr280xr
    xr280xr avatar
    13 posts
    Member since:
    Aug 2013

    Posted 21 Nov 2013 Link to this post

    I've narrowed down the cause of the issue. The version of a Telerik assembly reference on the masterpage was updated.
    <%@ register tagprefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI, Version=2011.1.315.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" %>
     
    <%@ register tagprefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI, Version=2012.1.411.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" %>

    This update causes both the RadMenu and RadRotator to stop behaving correctly on that page. The RadMenu is declared using the "telerik" prefix that is defined in this register directive, but as you can see above, the Rotator does not. The menu does behave correctly on other pages that use this master page, but on the page with the rotator, neither control behaves correctly (no images in the rotator, and menu doesn't display drop downs). Can two different Telerik.Web.UI versions not be used on the same page?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Slav
    Admin
    Slav avatar
    1355 posts

    Posted 26 Nov 2013 Link to this post

    Hi Jesse,

    Registering two versions of the RadControls for ASP.NET AJAX on the same page is not a supported scenario. Usually this causes an exception so it is strange that it only broke the client-side objects of the controls in your case. Please remove the older version's register directive.

    Also, the RadControls on the page need to utilize the tagprefix that is specified in the register directive, otherwise they will not be recognized. I would suggest setting the tagprefix of the rotator to telerik, as with the RadMenu.

    Regards,
    Slav
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  5. xr280xr
    xr280xr avatar
    13 posts
    Member since:
    Aug 2013

    Posted 26 Nov 2013 Link to this post

    Thanks Slav. The Rotator had its own tag prefix registered. I have updated both to use our latest Telerik version and the associated tag prefix defined for it in the web.config.
Back to Top