+1-888-365-2779
Try Now
More in this section
Categories
Bloggers
Blogs RSS feed

CustomDataSource to be introduced in public controls

by Ivan Osmak
With the Sitefinity 3.0 Service Pack 2 certain public controls will get a new property: CustomDataSource. The public controls that will get this property are following:

  • Telerik.Blogs.WebControls.PostList;
  • Telerik.News.WebControls.NewsList;
  • Telerik.Lists.WebControls.ListDisplay.

The main advantage of this property is that now you can wrap any of these public controls in a user control (or any other control for that matter), manipulate data the way you see it fit and then set the CustomDataSource property to the IList data source of your choice.

For example, when I was building a Archive control for this blog, I wanted to have a user control and a PostList control inside of it, but I didn't want the PostList control to use it's default data. What I wanted is for PostList control to display only posts published in a particular month. So getting the posts published in specific month is rather easy when you use BlogManager class, but the problem was that I could not influence which posts PostList control will display. And... I'm just too lazy to create a new control from scratch that will display posts, since there is already a control that does that. This led us to introduce the CustomDataSource property.

Though, with PostList and NewsList controls, it may not take too long to recreate the control from scratch, I'm sure you'll appreciate that we have done this for the ListDisplay control, which is moderately complicated control with all the display modes and javascript inside it.

When service pack is out, I'll provide you with sample code for this new feature and illustrate the idea furthermore.

Leave a comment