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

radrotator index issue with newest release

1 Answer 73 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Felipe
Top achievements
Rank 1
Felipe asked on 08 Apr 2011, 09:14 PM
Hello,

I think I may have found a problem (although it might not be an "exposed" problem) with the RadRotator in the most current release...

I am setting attribute values of the rotator item from the database on ItemDataBound...

then when the item is shown on the client, I update various GUI elements to what they should be based on the attributes.

getting the item attributes of the radrotator was a bit difficult, and someone at telerik helped me by providing me with the GetAttributeValue function (shown in the javascript code below).

Perhaps some of this has changed???

The page was working fine, and then when I updated to the new release it started behaving a bit differently...

if i move onto the nth item from the (n-1)th item, the GUI updates to the correct values for the (n-1)th item...

on the other hand, if i move onto the nth item from the (n+1)th item, the GUI updates to the correct values for the (n+1)th item...

any ideas?

void _rotator_ItemDataBound(object sender, RadRotatorEventArgs e)
{
    DataRowView itemView = e.Item.DataItem as DataRowView;
    if (itemView != null)
    {
        e.Item.Attributes["imageUrl"] = ImagesFolderUrl + itemView.Row["DocumentID"].ToString().PadLeft(8, '0') + "/" + itemView.Row["PageNumber"].ToString().PadLeft(4, '0');
        e.Item.Attributes["Author"] = isnullorempty(itemView.Row["Author"].ToString(), " ");
        e.Item.Attributes["AuthorTitle"] = isnullorempty(itemView.Row["AuthorTitle"].ToString(), " ");
        e.Item.Attributes["CompanyName"] = isnullorempty(itemView.Row["CompanyName"].ToString(), " ");
        e.Item.Attributes["PageNumber"] = itemView.Row["PageNumber"].ToString();
        e.Item.Attributes["TitleDescription"] = isnullorempty(itemView.Row["TitleDescription"].ToString(), " ");
        e.Item.Attributes["ConferenceName"] = isnullorempty(itemView.Row["Conference"].ToString(), " ");
        e.Item.Attributes["PresentationDate"] = ((DateTime)itemView.Row["DateOfPresentation"]).ToString("MMMM dd, yyyy");
        e.Item.Attributes["SlideID"] = itemView.Row["SlideID"].ToString();
        e.Item.Attributes["DocumentID"] = itemView.Row["DocumentID"].ToString();
        e.Item.Attributes["PageLayout"] = itemView.Row["PageLayout"].ToString();
 
        if (itemView.Row.Table.Columns.Contains("resultID"))
            e.Item.Attributes["resultID"] = itemView.Row["resultID"].ToString();
    }
}


function SetRotatorToSlideID(slideID) {
    var items = rotator.get_items();
    for (i in items) {
        if (slideID == GetAttributeValue(items[i], "SlideID")) {
            rotator.set_currentItemIndex(items[i].get_index(), true);
            UpdateGUI(items[i]);
            break;
        }
    }
}
 
function GetAttributeValue(anObject, strProperty) {
    if (anObject) {
        var attributes = $telerik.$('[' + strProperty + ']:first', anObject.get_element()).attr(strProperty);
        if (attributes) {
            return attributes;
        }
    }
}
 
function RotatorClientItemShowing(sender, args) {
    stateHandled = true;
    setLoading(true);
    UpdateGUI(args.get_item());
}
 
function RotatorClientItemShown(sender, args) {
    stateHandled = false;
}
 
function RotatorClientItemClicked(sender, args) {
    sender.set_currentItemIndex(args.get_item().get_index(), true);
}
 
function UpdateGUI(item) {
    var companyName = GetAttributeValue(item, "CompanyName");
    var title = GetAttributeValue(item, "TitleDescription");
    var pageNum = GetAttributeValue(item, "PageNumber");
    var author = GetAttributeValue(item, "Author");
    var authorTitle = GetAttributeValue(item, "AuthorTitle");
    var conference = GetAttributeValue(item, "ConferenceName");
    var presDate = GetAttributeValue(item, "PresentationDate");
    var layout = GetAttributeValue(item, "PageLayout");
 
    document.getElementById("lblSelectedRotatorItem").innerText = companyName + " - " + title + " - " + author + " - Page " + pageNum;
    document.getElementById("LargeImage").src = GetAttributeValue(item, "imageUrl") + ".png";
 
    document.getElementById("LargeImage").width = ImageWidth(layout);
 
    document.getElementById("lblCompanyName").innerText = companyName;
    document.getElementById("lblTitle").innerText = title;
    document.getElementById("lblConferenceName").innerText = conference;
    document.getElementById("lblAuthor").innerText = author;
    document.getElementById("lblAuthorTitle").innerText = authorTitle;
    document.getElementById("lblDate").innerText = presDate;
 
    setHash(GetAttributeValue(item, "DocumentID"), GetAttributeValue(item, "SlideID"));
    setLoading(false);
}


edit:

it seems that the RotatorClientItemClicked event is also a bit faulty...

when clicking an item, the rotator moves to the correct item, however it does NOT do so with animation...

in addition, the GUI does not change at all when this happens...

1 Answer, 1 is accepted

Sort by
0
Niko
Telerik team
answered on 11 Apr 2011, 12:52 PM
Hi Leland,

Please, find attached a sample page with a simplified implementation of the databound method(only one attribute is being set) and its extraction from the rotator item attribute data (note the content under the rotator saying "The id is #"). Using this setup I wasn't able to reproduce the issue that you are reporting on any browser. Still I can assume that the issue may be dependent other pieces of code, which I am missing, like the rotator definition, the definition of the labels or the whole page setup.
I advice you to open a support ticket and attach there a sample project that reproduces the behavior that you are describing so that we can investigate it further.

Kind regards,
Niko
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
Tags
Rotator
Asked by
Felipe
Top achievements
Rank 1
Answers by
Niko
Telerik team
Share this question
or