BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Telerik LightBox Control with Templates, Items Collection, Automatic Resizing and Paging

by Anand Narayanaswamy on Nov 25, 2013 |

The LightBox popup control included with Telerik's ASP.NET control suite provides support for templates, which provides an ability for the control to hold different type of content like images, iFrames, HTML code and ASP.NET server controls. It also enables you to bind to different datasources such as SqlDataSource, LinqDataSource, EntityDataSource and ObjectDataSource.

The control includes features such as automatic resizing, keyboard navigation, paging and modality and enables you to set different resize and fade animation types for open, hide, next and prev actions. It can be placed by double clicking it from the Visual Studio 2013 toolbox and usage will look like as shown below

<telerik:RadLightBox ID="RadLightBox1" runat="server" DataSourceID="SqlDataSource1"
DataImageUrlField="ImageUrl"
DataTitleField="ImageName"
DataDescriptionField="ImageInfo">
</telerik:RadLightBox>

In the above code, the control has been binded to a SQL Server data source. It is also possible to bind the control in code-behind in the same way as other controls. LightBox contains an Items collection and can be managed in three different ways such as In control declaration, code-behind using C#, VB and by using client-side JavaScript API.

In order to work with Items collection, create an object of RadLightBoxItem and add the required description, title, URL, width and height. Finally, add the object collection to an instance of RadLightBox control as shown below

RadLightBox1.Items.Add(newItem);

Daniel Peichev, Software Developer, Telerik in his blog post has examined the steps required to setup a relation between a given trigger control and an item from the Items collection.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT