Image slideshow
HI everyone,
I want to make a image slideshow in my pages.I find that there is a Rotator in Telerik.Web.UI. Can I using it to achieve my slideshow? and how?
Also, I find a forum thread
http://www.sitefinity.com/developer-network/forums/general-discussions-/slide-images-automatically
Someone made a widget but I cant use it since my version is 6.2
Cheers,
Wing
Hello,
In order to make an image slideshow in your pages you need to create image rotators control. Please refer to the NewsRotator sample in Sitefinity documentation which gives you a tutorial on how to build a control that can rotate images with the help of RadRotator control which main functionality is to rotate a set of images and apply different effects on them.
The rotator control can be used in Sitefinity the same way it is used on a standard ASP.NET user control. After creating the control register it in Administration->Settings->Advanced->Toolboxes->Toolboxes as also described in the documentation mentioned above.
The NewsRotator sample is also available in Sitefinity SDK which you can download from your own account.
Regards,
Anjeza Llapi
Telerik
Thanks for your help.
Now, I can made the Rotate slideshow.
On the other hand, I want to change the logic in the Page_Load such that I can call the image from the specific library. Can you give me some coding example to me?
Hello,
I would advise you to take a look at our NewsRotator control sample, where similar approach is taken except it is not pulling images, but news items. You can use similar query as the one used in the NewsRotator, but just alter it a bit to fit your needs and get the pages.
Here is a sample code I have prepared for your convenience:
protected void Page_Load(object sender, EventArgs e)
this.RadRotator1.DataSource = App.WorkWith()
.Pages().ThatArePublished().LocatedIn(PageLocation.Frontend)
.Get()
.ToList()
.Join(App.WorkWith()
.Images()
.Get()
.Where(i => i.Parent.Title == "Thumbnails" && i.Status == ContentLifecycleStatus.Live),
item => item.Title.Value,
image => image.Title.Value,
(item, image) => new PageItem = item, PageImage = image );
this.RadRotator1.ItemDataBound += this.RadRotator1_ItemDataBound;
this.RadRotator1.DataBind();
private void RadRotator1_ItemDataBound(object sender, RadRotatorEventArgs e)
var link = e.Item.FindControl("newsLink") as HyperLink;
var image = e.Item.FindControl("newsImage") as Image;
var title = e.Item.FindControl("newsTitle") as Label;
PageNode pageItem = (PageNode)TypeDescriptor.GetProperties(e.Item.DataItem)["PageItem"].GetValue(e.Item.DataItem);
Telerik.Sitefinity.Libraries.Model.Image pageImage = (Telerik.Sitefinity.Libraries.Model.Image)TypeDescriptor.GetProperties(e.Item.DataItem)["PageImage"].GetValue(e.Item.DataItem);
if (image != null) image.ImageUrl = pageImage.MediaUrl;
if (title != null) title.Text = pageItem.Title;
if (link != null)
link.NavigateUrl = DataResolver.Resolve(pageItem, "URL", null, pageItem.Id.ToString());