BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

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

This item in japanese

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

BT