This is a migrated thread and some comments may be shown as answers.

$find returning null

3 Answers 127 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Jesse
Top achievements
Rank 1
Veteran
Jesse asked on 21 Nov 2013, 06:55 PM
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.

3 Answers, 1 is accepted

Sort by
0
Jesse
Top achievements
Rank 1
Veteran
answered on 21 Nov 2013, 08:06 PM
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?
0
Accepted
Slav
Telerik team
answered on 26 Nov 2013, 08:23 AM
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.
0
Jesse
Top achievements
Rank 1
Veteran
answered on 26 Nov 2013, 06:54 PM
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.
Tags
Rotator
Asked by
Jesse
Top achievements
Rank 1
Veteran
Answers by
Jesse
Top achievements
Rank 1
Veteran
Slav
Telerik team
Share this question
or