BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

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

| by Anand Narayanaswamy on Nov 25, 2013. Estimated reading time: 1 minute |

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.

Rate this Article

Adoption Stage
Style

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

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and dont miss out on content that matters to you

BT