using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Telerik.WebControls;

namespace ControlToCheck
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ListControls(rcbControls, form1);
            }
        }

        private void ListControls(RadComboBox radComboBox, Control parent)
        {
            foreach (Control control in form1.Controls)
            {
                if ((control == null) ||
                    (control.ID == null) ||
                    (control is RadSpell) ||
                    (control == radComboBox))
                    continue;

                radComboBox.Items.Add(
                    new Telerik.WebControls.RadComboBoxItem(control.ID));
            }
        }

        protected void RadComboBox1_SelectedIndexChanged(
            object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            RadSpell1.ControlToCheck = e.Text;
        }
    }
}
