BT

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

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

Bookmarks

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
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.

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

Community comments

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

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

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.