private void BindCompatibleSections() { string selectedAction = String.Empty; if (ddlAction.SelectedIndex == -1 && ddlAction.Items.Count > 0) { selectedAction = ddlAction.Items[0].Value; } else { selectedAction = ddlAction.SelectedValue; } ArrayList compatibleModuleTypes = new ArrayList(); // Get all ModuleTypes. IList moduleTypes = CoreRepository.GetAll(typeof(ModuleType)); foreach (ModuleType mt in moduleTypes) { string assemblyQualifiedName = mt.ClassName + ", " + mt.AssemblyName; Type moduleTypeType = Type.GetType(assemblyQualifiedName); if (moduleTypeType != null) // throw exception when moduleTypeType == null? { ModuleBase moduleInstance = base.ModuleLoader.GetModuleFromType(mt); if (moduleInstance is IActionConsumer) { IActionConsumer actionConsumer = moduleInstance as IActionConsumer; CMS.Core.Communication.Action currentAction = _activeActionProvider.GetOutboundActions().FindByName(selectedAction); if (actionConsumer.GetInboundActions().Contains(currentAction)) { compatibleModuleTypes.Add(mt); } } } } if (compatibleModuleTypes.Count > 0) { // Retrieve all sections that have the compatible ModuleTypes IList compatibleSections = CoreRepository.GetSectionsByModuleTypes(compatibleModuleTypes); if (compatibleSections.Count > 0) { pnlTo.Visible = true; btnSave.Enabled = true; ddlSectionTo.DataSource = compatibleSections; ddlSectionTo.DataValueField = "Id"; ddlSectionTo.DataTextField = "FullName"; ddlSectionTo.DataBind(); } else { pnlTo.Visible = false; btnSave.Enabled = false; } } }