Preferred Language:
Listing 29.26 - ItemRotator.cs
using System;
using System.Collections;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace myControls
{
[ParseChildren(true, "Items")]
public class ItemRotator : CompositeControl
{
private ArrayList _items = new ArrayList();
[Browsable(false)]
public ArrayList Items
{
get { return _items; }
}
protected override void CreateChildControls()
{
Random rnd = new Random();
int index = rnd.Next(_items.Count);
Control item = (Control)_items[index];
this.Controls.Add(item);
}
}
public class Item : Control
{
}
}
Need ASP.NET and Visual Studio 2008 Training?
- Learn ASP.NET 3.5 from Stephen Walther, author of ASP.NET 3.5 Unleashed.
We've provided ASP.NET training for NASA, Lockheed Martin, the National Science Foundation, Verizon,
Boeing, the US House of Representatives, Kaiser, Petco, Mary Kay, and Microsoft.
Why not your company?
-
Receive a four day, hands-on, intensive workshop.
-
We fly to you, anywhere in the world.
-
We can bring our own laptops.
To learn more, visit the
Superexpert Training website.