I have a custom user control DatePicker.cs. Inside of another piece of code I have a collection of controls where I am checking the type of the control and doing some logic based on the type. My problem is the following:

typeof(DatePicker)

Evalutes to:

{Name = "DatePicker" FullName = "cusitecore.cedarsc.UserControls.DatePicker"}

But when I run the debugger and look at the type of the control that is on my web form it is:

{Name = "cedarsc_usercontrols_datepicker_ascx" FullName = "ASP.cedarsc_usercontrols_datepicker_ascx"}

These two things aren't equal so the correct logic isn't getting evaluated. I've tried using Type.GetType("ASP.cedarsc_usercontrols_datepicker_ascx") but this returns null.

EDIT

Here's what I'm trying to do:

private readonly Dictionary<Type, ControlType?> _controlTypes = new Dictionary<Type, ControlType?>
    {
        {typeof(CheckBox), ControlType.CheckBox},
        {typeof(CheckBoxList), ControlType.CheckBoxList},
        {typeof(DropDownList), ControlType.DropDownList},
        {typeof(HiddenField), ControlType.HiddenField},
        {typeof(ListBox), ControlType.ListBox},
        {typeof(RadioButton), ControlType.RadioButton},
        {typeof(RadioButtonList), ControlType.RadioButtonList},
        {typeof(TextBox), ControlType.TextBox},
        {typeof(Label), ControlType.Label},
        {typeof(DatePicker), ControlType.DatePicker},
        {typeof(CustomSelect), ControlType.CustomSelect}
    };

private void PopulateFields(Control control)
{
    ControlType? controlType;
    _controlTypes.TryGetValue(control.GetType(), out controlType);

    // recurse over the children
    if (control.Controls.Count > 0 && controlType == null) // don't want to recurse into children of controls we are reading values of
    {
        foreach(Control childControl in control.Controls)
     
Edit
Report