/// <summary> /// Fills class name selector. /// </summary> private void FillClassNameSelector() { Assembly selAssembly = null; try { selAssembly = ClassHelper.GetAssembly(drpAssemblyName.Text); } catch { // Assembly doesn't exist } drpClassName.DropDownList.Items.Clear(); if (selAssembly != null) { Type baseType = Type.GetType(BaseClassName); // Get list of available classes List <Type> types = selAssembly.GetTypes().Where(t => !t.IsDefined(typeof(CompilerGeneratedAttribute), false) && ((String.IsNullOrEmpty(BaseClassName)) || (t.IsClass && ((t.GetInterface(BaseClassName, true) != null) || ((baseType != null) && (t.IsSubclassOf(baseType))))))).OrderBy(t => t.Name).ToList <Type>(); bool selected = false; foreach (Type type in types) { if (!String.IsNullOrEmpty(type.Namespace) && !String.IsNullOrEmpty(type.Name)) { string fullName = type.Namespace + "." + type.Name; drpClassName.DropDownList.Items.Add(fullName); // Select first item after change if (!selected && URLHelper.IsPostback()) { drpClassName.SelectedValue = fullName; selected = true; } } } } // Clear selected value if drop down is empty if (drpClassName.DropDownList.Items.Count == 0) { drpClassName.SelectedValue = String.Empty; } }